<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160955] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160955">160955</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-20 18:47:10 -0800 (Fri, 20 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Remove the references to Node in InjectedScript
https://bugs.webkit.org/show_bug.cgi?id=126091

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2013-12-20
Reviewed by Timothy Hatcher.

Remove the last DOM references from InjectedScript so that
InjectedScript can move down into JavaScriptCore. The only
remaining references were to Nodes, which are all just thin
wrappers around existing functions. Move Node / JSNode (JSValue)
conversion into InspectorDOMAgent, where it was used.

No new tests, no observable change in functionality.

* bindings/js/JSInjectedScriptHostCustom.cpp:
* inspector/InjectedScript.cpp:
(WebCore::InjectedScript::inspectObject):
(WebCore::InjectedScript::releaseObject):
* inspector/InjectedScript.h:
* inspector/InjectedScriptHost.h:
* inspector/InjectedScriptSource.js:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::focusNode):
(WebCore::InspectorDOMAgent::highlightNode):
(WebCore::InspectorDOMAgent::requestNode):
(WebCore::InspectorDOMAgent::nodeForObjectId):
(WebCore::InspectorDOMAgent::resolveNode):
(WebCore::InspectorDOMAgent::scriptValueAsNode):
(WebCore::InspectorDOMAgent::nodeAsScriptValue):
* inspector/InspectorDOMAgent.h:
* inspector/PageConsoleAgent.cpp:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSInjectedScriptHostCustomcpp">trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptcpp">trunk/Source/WebCore/inspector/InjectedScript.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScripth">trunk/Source/WebCore/inspector/InjectedScript.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptHosth">trunk/Source/WebCore/inspector/InjectedScriptHost.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInjectedScriptSourcejs">trunk/Source/WebCore/inspector/InjectedScriptSource.js</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgentcpp">trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorDOMAgenth">trunk/Source/WebCore/inspector/InspectorDOMAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageConsoleAgentcpp">trunk/Source/WebCore/inspector/PageConsoleAgent.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/ChangeLog        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2013-12-20  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Remove the references to Node in InjectedScript
+        https://bugs.webkit.org/show_bug.cgi?id=126091
+
+        Reviewed by Timothy Hatcher.
+
+        Remove the last DOM references from InjectedScript so that
+        InjectedScript can move down into JavaScriptCore. The only
+        remaining references were to Nodes, which are all just thin
+        wrappers around existing functions. Move Node / JSNode (JSValue)
+        conversion into InspectorDOMAgent, where it was used.
+
+        No new tests, no observable change in functionality.
+
+        * bindings/js/JSInjectedScriptHostCustom.cpp:
+        * inspector/InjectedScript.cpp:
+        (WebCore::InjectedScript::inspectObject):
+        (WebCore::InjectedScript::releaseObject):
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScriptHost.h:
+        * inspector/InjectedScriptSource.js:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::focusNode):
+        (WebCore::InspectorDOMAgent::highlightNode):
+        (WebCore::InspectorDOMAgent::requestNode):
+        (WebCore::InspectorDOMAgent::nodeForObjectId):
+        (WebCore::InspectorDOMAgent::resolveNode):
+        (WebCore::InspectorDOMAgent::scriptValueAsNode):
+        (WebCore::InspectorDOMAgent::nodeAsScriptValue):
+        * inspector/InspectorDOMAgent.h:
+        * inspector/PageConsoleAgent.cpp:
+
</ins><span class="cx"> 2013-12-20  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Faster implementation of text-decoration-skip: ink
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSInjectedScriptHostCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -59,22 +59,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Node* InjectedScriptHost::scriptValueAsNode(Deprecated::ScriptValue value)
-{
-    if (!value.isObject() || value.isNull())
-        return 0;
-    return toNode(value.jsValue());
-}
-
-Deprecated::ScriptValue InjectedScriptHost::nodeAsScriptValue(JSC::ExecState* state, Node* node)
-{
-    if (!shouldAllowAccessToNode(state, node))
-        return Deprecated::ScriptValue(state-&gt;vm(), jsNull());
-
-    JSLockHolder lock(state);
-    return Deprecated::ScriptValue(state-&gt;vm(), toJS(state, deprecatedGlobalObjectForPrototype(state), node));
-}
-
</del><span class="cx"> JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     if (exec-&gt;argumentCount() &lt; 1)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScript.cpp (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScript.cpp        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/inspector/InjectedScript.cpp        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -144,29 +144,6 @@
</span><span class="cx">         *properties = array;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* InjectedScript::nodeForObjectId(const String&amp; objectId)
-{
-    if (hasNoValue() || !canAccessInspectedWindow())
-        return 0;
-
-    Deprecated::ScriptFunctionCall function(injectedScriptObject(), &quot;nodeForObjectId&quot;, WebCore::functionCallHandlerFromAnyThread);
-    function.appendArgument(objectId);
-
-    bool hadException = false;
-    Deprecated::ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
-    ASSERT(!hadException);
-
-    return InjectedScriptHost::scriptValueAsNode(resultValue);
-}
-
-void InjectedScript::releaseObject(const String&amp; objectId)
-{
-    Deprecated::ScriptFunctionCall function(injectedScriptObject(), &quot;releaseObject&quot;, WebCore::functionCallHandlerFromAnyThread);
-    function.appendArgument(objectId);
-    RefPtr&lt;InspectorValue&gt; result;
-    makeCall(function, &amp;result);
-}
-
</del><span class="cx"> #if ENABLE(JAVASCRIPT_DEBUGGER)
</span><span class="cx"> PassRefPtr&lt;Array&lt;CallFrame&gt;&gt; InjectedScript::wrapCallFrames(const Deprecated::ScriptValue&amp; callFrames)
</span><span class="cx"> {
</span><span class="lines">@@ -217,11 +194,6 @@
</span><span class="cx">     return Inspector::TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;Inspector::TypeBuilder::Runtime::RemoteObject&gt; InjectedScript::wrapNode(Node* node, const String&amp; groupName)
-{
-    return wrapObject(nodeAsScriptValue(node), groupName);
-}
-
</del><span class="cx"> Deprecated::ScriptValue InjectedScript::findObjectById(const String&amp; objectId) const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!hasNoValue());
</span><span class="lines">@@ -234,15 +206,23 @@
</span><span class="cx">     return resultValue;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InjectedScript::inspectNode(Node* node)
</del><ins>+void InjectedScript::inspectObject(Deprecated::ScriptValue value)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!hasNoValue());
</span><del>-    Deprecated::ScriptFunctionCall function(injectedScriptObject(), &quot;inspectNode&quot;, WebCore::functionCallHandlerFromAnyThread);
-    function.appendArgument(nodeAsScriptValue(node));
</del><ins>+    Deprecated::ScriptFunctionCall function(injectedScriptObject(), &quot;inspectObject&quot;, WebCore::functionCallHandlerFromAnyThread);
+    function.appendArgument(value);
</ins><span class="cx">     RefPtr&lt;InspectorValue&gt; result;
</span><span class="cx">     makeCall(function, &amp;result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InjectedScript::releaseObject(const String&amp; objectId)
+{
+    Deprecated::ScriptFunctionCall function(injectedScriptObject(), &quot;releaseObject&quot;, WebCore::functionCallHandlerFromAnyThread);
+    function.appendArgument(objectId);
+    RefPtr&lt;InspectorValue&gt; result;
+    makeCall(function, &amp;result);
+}
+
</ins><span class="cx"> void InjectedScript::releaseObjectGroup(const String&amp; objectGroup)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!hasNoValue());
</span><span class="lines">@@ -253,11 +233,6 @@
</span><span class="cx">     ASSERT(!hadException);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Deprecated::ScriptValue InjectedScript::nodeAsScriptValue(Node* node)
-{
-    return InjectedScriptHost::nodeAsScriptValue(scriptState(), node);
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScripth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScript.h (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScript.h        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/inspector/InjectedScript.h        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -85,27 +85,23 @@
</span><span class="cx">     void getFunctionDetails(ErrorString*, const String&amp; functionId, RefPtr&lt;Inspector::TypeBuilder::Debugger::FunctionDetails&gt;* result);
</span><span class="cx">     void getProperties(ErrorString*, const String&amp; objectId, bool ownProperties, RefPtr&lt;Inspector::TypeBuilder::Array&lt;Inspector::TypeBuilder::Runtime::PropertyDescriptor&gt;&gt;* result);
</span><span class="cx">     void getInternalProperties(ErrorString*, const String&amp; objectId, RefPtr&lt;Inspector::TypeBuilder::Array&lt;Inspector::TypeBuilder::Runtime::InternalPropertyDescriptor&gt;&gt;* result);
</span><del>-    Node* nodeForObjectId(const String&amp; objectId);
-    void releaseObject(const String&amp; objectId);
</del><span class="cx"> 
</span><span class="cx"> #if ENABLE(JAVASCRIPT_DEBUGGER)
</span><span class="cx">     PassRefPtr&lt;Inspector::TypeBuilder::Array&lt;Inspector::TypeBuilder::Debugger::CallFrame&gt;&gt; wrapCallFrames(const Deprecated::ScriptValue&amp;);
</span><span class="cx"> #endif
</span><del>-
</del><span class="cx">     PassRefPtr&lt;Inspector::TypeBuilder::Runtime::RemoteObject&gt; wrapObject(const Deprecated::ScriptValue&amp;, const String&amp; groupName, bool generatePreview = false) const;
</span><span class="cx">     PassRefPtr&lt;Inspector::TypeBuilder::Runtime::RemoteObject&gt; wrapTable(const Deprecated::ScriptValue&amp; table, const Deprecated::ScriptValue&amp; columns) const;
</span><del>-    PassRefPtr&lt;Inspector::TypeBuilder::Runtime::RemoteObject&gt; wrapNode(Node*, const String&amp; groupName);
</del><ins>+
</ins><span class="cx">     Deprecated::ScriptValue findObjectById(const String&amp; objectId) const;
</span><ins>+    void inspectObject(Deprecated::ScriptValue);
</ins><span class="cx"> 
</span><del>-    void inspectNode(Node*);
-    void releaseObjectGroup(const String&amp;);
</del><ins>+    void releaseObject(const String&amp; objectId);
+    void releaseObjectGroup(const String&amp; objectGroup);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend class InjectedScriptModule;
</span><span class="cx">     friend InjectedScript InjectedScriptManager::injectedScriptFor(JSC::ExecState*);
</span><span class="cx">     InjectedScript(Deprecated::ScriptObject, InspectedStateAccessCheck);
</span><del>-
-    Deprecated::ScriptValue nodeAsScriptValue(Node*);
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.h (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScriptHost.h        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.h        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -47,9 +47,6 @@
</span><span class="cx">     static PassRefPtr&lt;InjectedScriptHost&gt; create();
</span><span class="cx">     ~InjectedScriptHost() { }
</span><span class="cx"> 
</span><del>-    static Node* scriptValueAsNode(Deprecated::ScriptValue);
-    static Deprecated::ScriptValue nodeAsScriptValue(JSC::ExecState*, Node*);
-
</del><span class="cx"> private:
</span><span class="cx">     InjectedScriptHost() { }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInjectedScriptSourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InjectedScriptSource.js        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -125,7 +125,7 @@
</span><span class="cx">     /**
</span><span class="cx">      * @param {*} object
</span><span class="cx">      */
</span><del>-    inspectNode: function(object)
</del><ins>+    inspectObject: function(object)
</ins><span class="cx">     {
</span><span class="cx">         if (this._commandLineAPIImpl)
</span><span class="cx">             this._commandLineAPIImpl.inspect(object);
</span><span class="lines">@@ -642,18 +642,6 @@
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     /**
</span><del>-     * @param {string} objectId
-     * @return {Node}
-     */
-    nodeForObjectId: function(objectId)
-    {
-        var object = this.findObjectById(objectId);
-        if (!object || this._subtype(object) !== &quot;node&quot;)
-            return null;
-        return /** @type {Node} */ (object);
-    },
-
-    /**
</del><span class="cx">      * @param {string} name
</span><span class="cx">      * @return {Object}
</span><span class="cx">      */
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -77,11 +77,13 @@
</span><span class="cx"> #include &quot;InstrumentingAgents.h&quot;
</span><span class="cx"> #include &quot;IntRect.h&quot;
</span><span class="cx"> #include &quot;JSEventListener.h&quot;
</span><ins>+#include &quot;JSNode.h&quot;
</ins><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MutationEvent.h&quot;
</span><span class="cx"> #include &quot;Node.h&quot;
</span><span class="cx"> #include &quot;NodeList.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><ins>+#include &quot;PageInjectedScriptManager.h&quot;
</ins><span class="cx"> #include &quot;Pasteboard.h&quot;
</span><span class="cx"> #include &quot;RenderStyle.h&quot;
</span><span class="cx"> #include &quot;RenderStyleConstants.h&quot;
</span><span class="lines">@@ -998,11 +1000,12 @@
</span><span class="cx">     if (!frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptFor(mainWorldExecState(frame));
</del><ins>+    JSC::ExecState* scriptState = mainWorldExecState(frame);
+    InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptFor(scriptState);
</ins><span class="cx">     if (injectedScript.hasNoValue())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    injectedScript.inspectNode(node.get());
</del><ins>+    injectedScript.inspectObject(InspectorDOMAgent::nodeAsScriptValue(scriptState, node.get()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorDOMAgent::mouseDidMoveOverElement(const HitTestResult&amp; result, unsigned)
</span><span class="lines">@@ -1090,8 +1093,7 @@
</span><span class="cx">     if (nodeId) {
</span><span class="cx">         node = assertNode(errorString, *nodeId);
</span><span class="cx">     } else if (objectId) {
</span><del>-        InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptForObjectId(*objectId);
-        node = injectedScript.nodeForObjectId(*objectId);
</del><ins>+        node = nodeForObjectId(*objectId);
</ins><span class="cx">         if (!node)
</span><span class="cx">             *errorString = &quot;Node for given objectId not found&quot;;
</span><span class="cx">     } else
</span><span class="lines">@@ -1241,8 +1243,7 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorDOMAgent::requestNode(ErrorString*, const String&amp; objectId, int* nodeId)
</span><span class="cx"> {
</span><del>-    InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptForObjectId(objectId);
-    Node* node = injectedScript.nodeForObjectId(objectId);
</del><ins>+    Node* node = nodeForObjectId(objectId);
</ins><span class="cx">     if (node)
</span><span class="cx">         *nodeId = pushNodePathToFrontend(node);
</span><span class="cx">     else
</span><span class="lines">@@ -1706,6 +1707,13 @@
</span><span class="cx">     return node;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Node* InspectorDOMAgent::nodeForObjectId(const String&amp; objectId)
+{
+    InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptForObjectId(objectId);
+    Deprecated::ScriptValue value = injectedScript.findObjectById(objectId);
+    return InspectorDOMAgent::scriptValueAsNode(value);
+}
+
</ins><span class="cx"> void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString* errorString, const String&amp; path, int* nodeId)
</span><span class="cx"> {
</span><span class="cx">     if (Node* node = nodeForPath(path))
</span><span class="lines">@@ -1737,13 +1745,31 @@
</span><span class="cx">     if (!frame)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptFor(mainWorldExecState(frame));
</del><ins>+    JSC::ExecState* scriptState = mainWorldExecState(frame);
+    InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptFor(scriptState);
</ins><span class="cx">     if (injectedScript.hasNoValue())
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return injectedScript.wrapNode(node, objectGroup);
</del><ins>+    return injectedScript.wrapObject(InspectorDOMAgent::nodeAsScriptValue(scriptState, node), objectGroup);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Node* InspectorDOMAgent::scriptValueAsNode(Deprecated::ScriptValue value)
+{
+    if (!value.isObject() || value.isNull())
+        return nullptr;
+
+    return toNode(value.jsValue());
+}
+
+Deprecated::ScriptValue InspectorDOMAgent::nodeAsScriptValue(JSC::ExecState* state, Node* node)
+{
+    if (!shouldAllowAccessToNode(state, node))
+        return Deprecated::ScriptValue(state-&gt;vm(), JSC::jsNull());
+
+    JSC::JSLockHolder lock(state);
+    return Deprecated::ScriptValue(state-&gt;vm(), toJS(state, deprecatedGlobalObjectForPrototype(state), node));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INSPECTOR)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorDOMAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -208,6 +208,9 @@
</span><span class="cx">     Element* assertElement(ErrorString*, int nodeId);
</span><span class="cx">     Document* assertDocument(ErrorString*, int nodeId);
</span><span class="cx"> 
</span><ins>+    static Node* scriptValueAsNode(Deprecated::ScriptValue);
+    static Deprecated::ScriptValue nodeAsScriptValue(JSC::ExecState*, Node*);
+
</ins><span class="cx">     // Methods called from other agents.
</span><span class="cx">     InspectorPageAgent* pageAgent() { return m_pageAgent; }
</span><span class="cx"> 
</span><span class="lines">@@ -238,6 +241,7 @@
</span><span class="cx">     PassRefPtr&lt;Inspector::TypeBuilder::DOM::EventListener&gt; buildObjectForEventListener(const RegisteredEventListener&amp;, const AtomicString&amp; eventType, Node*, const String* objectGroupId);
</span><span class="cx"> 
</span><span class="cx">     Node* nodeForPath(const String&amp; path);
</span><ins>+    Node* nodeForObjectId(const String&amp; objectId);
</ins><span class="cx"> 
</span><span class="cx">     void discardBindings();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageConsoleAgent.cpp (160954 => 160955)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageConsoleAgent.cpp        2013-12-21 02:25:19 UTC (rev 160954)
+++ trunk/Source/WebCore/inspector/PageConsoleAgent.cpp        2013-12-21 02:47:10 UTC (rev 160955)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     explicit InspectableNode(Node* node) : m_node(node) { }
</span><span class="cx">     virtual Deprecated::ScriptValue get(JSC::ExecState* state) OVERRIDE
</span><span class="cx">     {
</span><del>-        return InjectedScriptHost::nodeAsScriptValue(state, m_node);
</del><ins>+        return InspectorDOMAgent::nodeAsScriptValue(state, m_node);
</ins><span class="cx">     }
</span><span class="cx"> private:
</span><span class="cx">     Node* m_node;
</span></span></pre>
</div>
</div>

</body>
</html>