Index: inspector/InspectorBackend.cpp |
=================================================================== |
--- inspector/InspectorBackend.cpp (revision 53180) |
+++ inspector/InspectorBackend.cpp (working copy) |
@@ -40,6 +40,7 @@ |
#include "Frame.h" |
#include "FrameLoader.h" |
#include "HTMLFrameOwnerElement.h" |
+#include "InjectedScriptHost.h" |
#include "InspectorClient.h" |
#include "InspectorController.h" |
#include "InspectorDOMAgent.h" |
@@ -256,13 +257,31 @@ |
} |
#endif |
-void InspectorBackend::dispatchOnInjectedScript(long callId, const String& methodName, const String& arguments, bool async) |
+void InspectorBackend::setInjectedScriptSource(const String& source) |
{ |
+ if (m_inspectorController) |
+ m_inspectorController->injectedScriptHost()->setInjectedScriptSource(source); |
+} |
+ |
+void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async) |
+{ |
InspectorFrontend* frontend = inspectorFrontend(); |
if (!frontend) |
return; |
- ScriptFunctionCall function(m_inspectorController->m_scriptState, m_inspectorController->m_injectedScriptObj, "dispatch"); |
+ // FIXME: explicitly pass injectedScriptId along with node id to the frontend. |
+ bool injectedScriptIdIsNodeId = injectedScriptId <= 0; |
+ |
+ ScriptObject injectedScript; |
+ if (injectedScriptIdIsNodeId) |
+ injectedScript = m_inspectorController->injectedScriptForNodeId(-injectedScriptId); |
+ else |
+ injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForId(injectedScriptId); |
+ |
+ if (injectedScript.hasNoValue()) |
+ return; |
+ |
+ ScriptFunctionCall function(injectedScript.scriptState(), injectedScript, "dispatch"); |
function.appendArgument(methodName); |
function.appendArgument(arguments); |
if (async) |
@@ -274,7 +293,7 @@ |
if (hadException) |
frontend->didDispatchOnInjectedScript(callId, "", true); |
else |
- frontend->didDispatchOnInjectedScript(callId, result.toString(m_inspectorController->m_scriptState), false); |
+ frontend->didDispatchOnInjectedScript(callId, result.toString(injectedScript.scriptState()), false); |
} |
void InspectorBackend::getChildNodes(long callId, long nodeId) |
@@ -371,10 +390,11 @@ |
m_inspectorController->deleteCookie(cookieName, domain); |
} |
-void InspectorBackend::releaseWrapperObjectGroup(const String& objectGroup) |
+void InspectorBackend::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) |
{ |
- if (m_inspectorController) |
- m_inspectorController->releaseWrapperObjectGroup(objectGroup); |
+ if (!m_inspectorController) |
+ return; |
+ m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup); |
} |
void InspectorBackend::didEvaluateForTestInFrontend(long callId, const String& jsonResult) |