Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/no_permissions/test.js

Issue 11824004: Do not pass URLs in onUpdated events to extensions unless they have the (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update test Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/no_permissions/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function assertNoSensitiveFields(tab) {
6 ['url', 'title', 'faviconUrl'].forEach(function(field) {
7 chrome.test.assertEq(undefined, tab[field],
8 'Sensitive property ' + field + ' is visible')
9 });
10 }
11
12 chrome.test.runTests([
13 function testOnUpdated() {
14 var neededCallbacks = 3; // two onUpdateListener calls, one create callback
15 var countDown = function() {
16 neededCallbacks--;
17 if (neededCallbacks == 0) {
18 chrome.tabs.onUpdated.removeListener(onUpdateListener);
19 chrome.test.succeed();
20 }
21 };
22
23 var onUpdateListener = function(tabId, info, tab) {
24 assertNoSensitiveFields(info);
25 assertNoSensitiveFields(tab);
26 countDown();
27 }
28
29 chrome.tabs.onUpdated.addListener(onUpdateListener);
30 chrome.tabs.create({url: 'chrome://newtab/'}, function(tab) {
31 assertNoSensitiveFields(tab);
32 chrome.tabs.update(tab.id, {url: 'about:blank'}, function(tab) {
33 assertNoSensitiveFields(tab);
34 countDown();
35 });
36 });
37 },
38
39 function testQuery() {
40 chrome.tabs.create({url: 'chrome://newtab/'});
41 chrome.tabs.query({active: true}, chrome.test.callbackPass(function(tabs) {
42 chrome.test.assertEq(1, tabs.length);
43 assertNoSensitiveFields(tabs[0]);
44 }));
45 },
46
47 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/tabs/no_permissions/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698