summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/resources/extension_process_bindings.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/resources/extension_process_bindings.js')
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index d7b0aac..6fd334a 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -18,12 +18,23 @@ var chrome = chrome || {};
native function GetPopupParentWindow();
native function GetPopupView();
native function SetExtensionActionIcon();
+ native function IsExtensionProcess();
+
+ var chromeHidden = GetChromeHidden();
+
+ // These bindings are for the extension process only. Since a chrome-extension
+ // URL can be loaded in an iframe of a regular renderer, we check here to
+ // ensure we don't expose the APIs in that case.
+ if (!IsExtensionProcess()) {
+ chromeHidden.onLoad.addListener(function (extensionId) {
+ chrome.initExtension(extensionId, false);
+ });
+ return;
+ }
if (!chrome)
chrome = {};
- var chromeHidden = GetChromeHidden();
-
// Validate arguments.
chromeHidden.validationTypes = [];
chromeHidden.validate = function(args, schemas) {