diff options
6 files changed, 13 insertions, 14 deletions
diff --git a/chrome/renderer/extensions/user_script_slave.cc b/chrome/renderer/extensions/user_script_slave.cc index 8a39c5b..c064197 100644 --- a/chrome/renderer/extensions/user_script_slave.cc +++ b/chrome/renderer/extensions/user_script_slave.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -310,8 +310,6 @@ void UserScriptSlave::InjectScripts(WebFrame* frame, WebScriptSource(WebString::fromUTF8(api_js_.as_string()))); } - // Setup chrome.self to contain an Extension object with the correct - // ID. // TODO(aa): Can extension_id() ever be empty anymore? if (!script->extension_id().empty()) isolated_world_id = GetIsolatedWorldIdForExtension(extension, frame); diff --git a/chrome/renderer/resources/extensions/miscellaneous_bindings.js b/chrome/renderer/resources/extensions/miscellaneous_bindings.js index 37ce11d..ed4357c 100644 --- a/chrome/renderer/resources/extensions/miscellaneous_bindings.js +++ b/chrome/renderer/resources/extensions/miscellaneous_bindings.js @@ -204,10 +204,11 @@ var chrome = chrome || {}; manifestVersion = tempManifestVersion; chrome.extension = chrome.extension || {}; - chrome.self = chrome.extension; - if (manifestVersion < 2) + if (manifestVersion < 2) { + chrome.self = chrome.extension; chrome.extension.inIncognitoTab = inIncognitoContext; + } chrome.extension.inIncognitoContext = inIncognitoContext; diff --git a/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js b/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js index 5d5104c..5189ebd 100644 --- a/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js +++ b/chrome/test/data/extensions/api_test/executescript/frame_after_load/test.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -19,7 +19,7 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { 'document.body.appendChild(frame)'; var postFrameCode = 'chrome.extension.connect().postMessage("done");'; - chrome.self.onConnect.addListener(function(port) { + chrome.extension.onConnect.addListener(function(port) { port.onMessage.addListener(function(data) { if (data == 'loaded') { chrome.tabs.executeScript(tabId, {code: postFrameCode}); diff --git a/chrome/test/data/extensions/api_test/executescript/in_frame/test.js b/chrome/test/data/extensions/api_test/executescript/in_frame/test.js index 9634eee..0312e99c 100644 --- a/chrome/test/data/extensions/api_test/executescript/in_frame/test.js +++ b/chrome/test/data/extensions/api_test/executescript/in_frame/test.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -29,11 +29,11 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { totalTitles += data.message; }); }; - chrome.self.onConnect.addListener(eventListener); + chrome.extension.onConnect.addListener(eventListener); chrome.tabs.executeScript(tabId, script_file, pass(function() { assertEq(counter, 5); assertEq(totalTitles, 'frametest0test1test2test3'); - chrome.self.onConnect.removeListener(eventListener); + chrome.extension.onConnect.removeListener(eventListener); })); }, @@ -49,7 +49,7 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { newStyle += data.message; }); }; - chrome.self.onConnect.addListener(eventListener); + chrome.extension.onConnect.addListener(eventListener); chrome.tabs.insertCSS(tabId, css_file, function() { var script_file = {}; script_file.file = 'script.js'; @@ -58,7 +58,7 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { pass(function() { assertEq(newStyle, 'nonenonenonenone'); assertEq(counter, 4); - chrome.self.onConnect.removeListener(eventListener); + chrome.extension.onConnect.removeListener(eventListener); })); }); } diff --git a/chrome/test/data/extensions/browsertest/crash_25562/background.js b/chrome/test/data/extensions/browsertest/crash_25562/background.js index 0264428..0ddef86 100644 --- a/chrome/test/data/extensions/browsertest/crash_25562/background.js +++ b/chrome/test/data/extensions/browsertest/crash_25562/background.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -chrome.self.onConnect.addListener(function(port) { +chrome.extension.onConnect.addListener(function(port) { port.onMessage.addListener(function() { // Let Chrome know that the PageAction needs to be enabled for this tabId // and for the url of this page. diff --git a/chrome/test/data/extensions/browsertest/title_localized_pa/background.js b/chrome/test/data/extensions/browsertest/title_localized_pa/background.js index 0031ace..37fae35 100644 --- a/chrome/test/data/extensions/browsertest/title_localized_pa/background.js +++ b/chrome/test/data/extensions/browsertest/title_localized_pa/background.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -chrome.self.onConnect.addListener(function(port) { +chrome.extension.onConnect.addListener(function(port) { port.onMessage.addListener(function(mybool) { // Let Chrome know that the PageAction needs to be enabled for this tabId // and for the url of this page. |