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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/tabs/no_permissions/test.js
diff --git a/chrome/test/data/extensions/api_test/tabs/no_permissions/test.js b/chrome/test/data/extensions/api_test/tabs/no_permissions/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..9718173f73b693dfb3a90cbcafd0313c3167cbbe
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tabs/no_permissions/test.js
@@ -0,0 +1,47 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function assertNoSensitiveFields(tab) {
+ ['url', 'title', 'faviconUrl'].forEach(function(field) {
+ chrome.test.assertEq(undefined, tab[field],
+ 'Sensitive property ' + field + ' is visible')
+ });
+}
+
+chrome.test.runTests([
+ function testOnUpdated() {
+ var neededCallbacks = 3; // two onUpdateListener calls, one create callback
+ var countDown = function() {
+ neededCallbacks--;
+ if (neededCallbacks == 0) {
+ chrome.tabs.onUpdated.removeListener(onUpdateListener);
+ chrome.test.succeed();
+ }
+ };
+
+ var onUpdateListener = function(tabId, info, tab) {
+ assertNoSensitiveFields(info);
+ assertNoSensitiveFields(tab);
+ countDown();
+ }
+
+ chrome.tabs.onUpdated.addListener(onUpdateListener);
+ chrome.tabs.create({url: 'chrome://newtab/'}, function(tab) {
+ assertNoSensitiveFields(tab);
+ chrome.tabs.update(tab.id, {url: 'about:blank'}, function(tab) {
+ assertNoSensitiveFields(tab);
+ countDown();
+ });
+ });
+ },
+
+ function testQuery() {
+ chrome.tabs.create({url: 'chrome://newtab/'});
+ chrome.tabs.query({active: true}, chrome.test.callbackPass(function(tabs) {
+ chrome.test.assertEq(1, tabs.length);
+ assertNoSensitiveFields(tabs[0]);
+ }));
+ },
+
+]);
« 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