Index: chrome/renderer/resources/extension_process_bindings.js |
=================================================================== |
--- chrome/renderer/resources/extension_process_bindings.js (revision 24584) |
+++ chrome/renderer/resources/extension_process_bindings.js (working copy) |
@@ -19,6 +19,8 @@ |
native function GetChromeHidden(); |
native function GetNextRequestId(); |
native function OpenChannelToTab(); |
+ native function ExecuteScript(); |
+ native function ExecuteScriptWithUrl(); |
if (!chrome) |
chrome = {}; |
@@ -281,6 +283,21 @@ |
return GetExtensionViews(windowId, "TAB"); |
} |
+ apiFunctions["extension.executeScriptCode"].handleRequest = |
+ function(scriptCode) { |
+ return ExecuteScript(scriptCode); |
+ } |
+ |
+ apiFunctions["extension.executeScriptWithUrl"].handleRequest = |
+ function(scriptUrl) { |
+ var requestId = GetNextRequestId(); |
+ var executeScriptCodeCallback = function(scriptCode) { |
+ return ExecuteScript(scriptCode); |
+ } |
+ callbacks[requestId] = executeScriptCodeCallback; |
+ return ExecuteScriptWithUrl(requestId, JSON.stringify(scriptUrl)); |
+ } |
+ |
apiFunctions["devtools.getTabEvents"].handleRequest = function(tabId) { |
var tabIdProxy = {}; |
forEach(["onPageEvent", "onTabUrlChange", "onTabClose"], |