summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/InjectedScriptHost.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-02 14:57:50 +0000
committerSteve Block <steveblock@google.com>2010-02-04 15:06:55 +0000
commitd0825bca7fe65beaee391d30da42e937db621564 (patch)
tree7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/inspector/InjectedScriptHost.cpp
parent3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff)
downloadexternal_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz
external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/inspector/InjectedScriptHost.cpp')
-rw-r--r--WebCore/inspector/InjectedScriptHost.cpp55
1 files changed, 40 insertions, 15 deletions
diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp
index f326f52..d5bbd1c 100644
--- a/WebCore/inspector/InjectedScriptHost.cpp
+++ b/WebCore/inspector/InjectedScriptHost.cpp
@@ -72,6 +72,7 @@ namespace WebCore {
InjectedScriptHost::InjectedScriptHost(InspectorController* inspectorController)
: m_inspectorController(inspectorController)
+ , m_nextInjectedScriptId(1)
{
}
@@ -79,6 +80,12 @@ InjectedScriptHost::~InjectedScriptHost()
{
}
+void InjectedScriptHost::clearConsoleMessages()
+{
+ if (m_inspectorController)
+ m_inspectorController->clearConsoleMessages();
+}
+
void InjectedScriptHost::copyText(const String& text)
{
Pasteboard::generalPasteboard()->writePlainText(text);
@@ -91,27 +98,15 @@ Node* InjectedScriptHost::nodeForId(long nodeId)
return 0;
}
-ScriptValue InjectedScriptHost::wrapObject(const ScriptValue& object, const String& objectGroup)
-{
- if (m_inspectorController)
- return m_inspectorController->wrapObject(object, objectGroup);
- return ScriptValue();
-}
-
-ScriptValue InjectedScriptHost::unwrapObject(const String& objectId)
-{
- if (m_inspectorController)
- return m_inspectorController->unwrapObject(objectId);
- return ScriptValue();
-}
-
-long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool selectInUI)
+long InjectedScriptHost::pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI)
{
InspectorFrontend* frontend = inspectorFrontend();
InspectorDOMAgent* domAgent = inspectorDOMAgent();
if (!domAgent || !frontend)
return 0;
long id = domAgent->pushNodePathToFrontend(node);
+ if (withChildren)
+ domAgent->pushChildNodesToFrontend(id);
if (selectInUI)
frontend->updateFocusedNode(id);
return id;
@@ -172,6 +167,29 @@ void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, const St
frontend->didDispatchOnInjectedScript(callId, result, isException);
}
+ScriptObject InjectedScriptHost::injectedScriptForId(long id)
+{
+ return m_idToInjectedScript.get(id);
+}
+
+void InjectedScriptHost::discardInjectedScripts()
+{
+ m_idToInjectedScript.clear();
+}
+
+void InjectedScriptHost::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
+{
+ if (injectedScriptId) {
+ ScriptObject injectedScript = m_idToInjectedScript.get(injectedScriptId);
+ if (!injectedScript.hasNoValue())
+ releaseWrapperObjectGroup(injectedScript, objectGroup);
+ } else {
+ // Iterate over all injected scripts if injectedScriptId is not specified.
+ for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it)
+ releaseWrapperObjectGroup(it->second, objectGroup);
+ }
+}
+
InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent()
{
if (!m_inspectorController)
@@ -186,6 +204,13 @@ InspectorFrontend* InjectedScriptHost::inspectorFrontend()
return m_inspectorController->m_frontend.get();
}
+void InjectedScriptHost::releaseWrapperObjectGroup(const ScriptObject& injectedScript, const String& objectGroup)
+{
+ ScriptFunctionCall releaseFunction(injectedScript.scriptState(), injectedScript, "releaseWrapperObjectGroup");
+ releaseFunction.appendArgument(objectGroup);
+ releaseFunction.call();
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR)