Index: Source/web/InspectorFrontendClientImpl.cpp |
diff --git a/Source/web/InspectorFrontendClientImpl.cpp b/Source/web/InspectorFrontendClientImpl.cpp |
index c5ebdab8cd9228fbc98b564c8ff0f7f484c8d0a6..60e1eb24f53ee1bd4e6025f7e9c6170125b5b02e 100644 |
--- a/Source/web/InspectorFrontendClientImpl.cpp |
+++ b/Source/web/InspectorFrontendClientImpl.cpp |
@@ -74,6 +74,39 @@ void InspectorFrontendClientImpl::windowObjectCleared() |
v8::Handle<v8::Object> global = frameContext->Global(); |
global->Set(v8::String::New("InspectorFrontendHost"), frontendHostObj); |
+ |
+ ScriptController* scriptController = m_frontendPage->mainFrame() ? m_frontendPage->mainFrame()->script() : 0; |
+ if (scriptController) { |
+ String installLegacyOverrides = |
+ "(function(host, legacyMethodNames) {" |
+ " function dispatch(methodName, oldImpl) {" |
+ " var argsArray = Array.prototype.slice.call(arguments, 2);" |
+ " var message = {'method': methodName};" |
+ " if (argsArray.length)" |
+ " message.params = argsArray;" |
+ " this.sendMessageToEmbedder(JSON.stringify(message));" |
+ " if (oldImpl)" |
+ " oldImpl.apply(this, argsArray);" |
+ " };" |
+ " legacyMethodNames.forEach(function(methodName) {" |
+ " host[methodName] = dispatch.bind(host, methodName, host[methodName]);" |
+ " });" |
+ "})(InspectorFrontendHost," |
+ " ['moveWindowBy'," |
+ " 'bringToFront'," |
+ " 'requestSetDockSide'," |
+ " 'openInNewTab'," |
+ " 'save'," |
+ " 'append'," |
+ " 'requestFileSystems'," |
+ " 'indexPath'," |
+ " 'stopIndexing'," |
+ " 'searchInPath'," |
+ " 'addFileSystem'," |
+ " 'removeFileSystem']);"; |
+ |
+ scriptController->executeScriptInMainWorld(ScriptSourceCode(installLegacyOverrides)); |
+ } |
} |
void InspectorFrontendClientImpl::moveWindowBy(float x, float y) |
@@ -132,6 +165,11 @@ void InspectorFrontendClientImpl::sendMessageToBackend(const String& message) |
m_client->sendMessageToBackend(message); |
} |
+void InspectorFrontendClientImpl::sendMessageToEmbedder(const String& message) |
+{ |
+ m_client->sendMessageToEmbedder(message); |
+} |
+ |
void InspectorFrontendClientImpl::requestFileSystems() |
{ |
m_client->requestFileSystems(); |