 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| 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..bf0ca9c84b7dc92a4605e1edee40ac4d17f9f26c | 
| --- /dev/null | 
| +++ b/chrome/test/data/extensions/api_test/tabs/no_permissions/test.js | 
| @@ -0,0 +1,46 @@ | 
| +// 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 neededEvents = 3; // two onUpdateListener calls, one create callback | 
| + var eventHandled = function() { | 
| + neededEvents--; | 
| + if (neededEvents == 0) { | 
| + chrome.tabs.onUpdated.removeListener(onUpdateListener); | 
| + chrome.test.succeed(); | 
| + } | 
| + }; | 
| + | 
| + var onUpdateListener = function(tabId, info, tab) { | 
| + assertNoSensitiveFields(tab); | 
| + eventHandled(); | 
| + } | 
| + | 
| + 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); | 
| + eventHandled(); | 
| 
not at google - send to devlin
2013/01/11 21:44:41
nitty comment: I was briefly confused here, this i
 
not at google - send to devlin
2013/01/11 21:45:22
s/event/function/
 
mvrable
2013/01/11 21:57:06
Done.
 | 
| + }); | 
| + }); | 
| + }, | 
| + | 
| + 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]); | 
| + })); | 
| + }, | 
| + | 
| +]); |