2010-06-16 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jun 2010 09:43:57 +0000 (09:43 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jun 2010 09:43:57 +0000 (09:43 +0000)
        Reviewed by Joe Pecoraro.

        Web Inspector: move get/setOuterHTML, addInspectedNode and
        clearConsole to native InspectorDOMAgent. This is done to allow
        inspected nodes array to store nodes from different domains,
        also moves outerhtml manipulation closer to the rest of the DOM
        operations. In addition to that, we are slowly getting rid of
        InjectedScriptAccess in favor of IDL-defined InspectorBackend
        interface for clearer remote debugging API.

        https://bugs.webkit.org/show_bug.cgi?id=40733

        * inspector/InjectedScriptHost.cpp:
        (WebCore::InjectedScriptHost::inspectedNode):
        * inspector/InjectedScriptHost.h:
        * inspector/InspectorBackend.cpp:
        (WebCore::InspectorBackend::changeTagName):
        (WebCore::InspectorBackend::getOuterHTML):
        (WebCore::InspectorBackend::setOuterHTML):
        (WebCore::InspectorBackend::addInspectedNode):
        (WebCore::InspectorBackend::clearConsoleMessages):
        * inspector/InspectorBackend.h:
        * inspector/InspectorBackend.idl:
        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::inspectedNode):
        (WebCore::InspectorDOMAgent::changeTagName):
        (WebCore::InspectorDOMAgent::getOuterHTML):
        (WebCore::InspectorDOMAgent::setOuterHTML):
        (WebCore::InspectorDOMAgent::addInspectedNode):
        * inspector/InspectorDOMAgent.h:
        * inspector/InspectorFrontend.cpp:
        (WebCore::InspectorFrontend::didGetOuterHTML):
        (WebCore::InspectorFrontend::didSetOuterHTML):
        * inspector/InspectorFrontend.h:
        * inspector/front-end/ConsoleView.js:
        (WebInspector.ConsoleView.prototype.requestClearMessages):
        * inspector/front-end/DOMAgent.js:
        * inspector/front-end/ElementsPanel.js:
        (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged):
        (WebInspector.ElementsPanel):
        * inspector/front-end/ElementsTreeOutline.js:
        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback):
        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted):
        ():
        * inspector/front-end/InjectedScript.js:
        (injectedScriptConstructor):
        * inspector/front-end/InjectedScriptAccess.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@61317 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
WebCore/ChangeLog
WebCore/inspector/InjectedScriptHost.cpp
WebCore/inspector/InjectedScriptHost.h
WebCore/inspector/InjectedScriptHost.idl
WebCore/inspector/InspectorBackend.cpp
WebCore/inspector/InspectorBackend.h
WebCore/inspector/InspectorBackend.idl
WebCore/inspector/InspectorDOMAgent.cpp
WebCore/inspector/InspectorDOMAgent.h
WebCore/inspector/InspectorFrontend.cpp
WebCore/inspector/InspectorFrontend.h
WebCore/inspector/front-end/ConsoleView.js
WebCore/inspector/front-end/DOMAgent.js
WebCore/inspector/front-end/ElementsPanel.js
WebCore/inspector/front-end/ElementsTreeOutline.js
WebCore/inspector/front-end/InjectedScript.js
WebCore/inspector/front-end/InjectedScriptAccess.js

index 84bc917..fccd21a 100644 (file)
@@ -1,3 +1,53 @@
+2010-06-16  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Joe Pecoraro.
+
+        Web Inspector: move get/setOuterHTML, addInspectedNode and
+        clearConsole to native InspectorDOMAgent. This is done to allow
+        inspected nodes array to store nodes from different domains,
+        also moves outerhtml manipulation closer to the rest of the DOM
+        operations. In addition to that, we are slowly getting rid of
+        InjectedScriptAccess in favor of IDL-defined InspectorBackend
+        interface for clearer remote debugging API.
+
+        https://bugs.webkit.org/show_bug.cgi?id=40733
+
+        * inspector/InjectedScriptHost.cpp:
+        (WebCore::InjectedScriptHost::inspectedNode):
+        * inspector/InjectedScriptHost.h:
+        * inspector/InspectorBackend.cpp:
+        (WebCore::InspectorBackend::changeTagName):
+        (WebCore::InspectorBackend::getOuterHTML):
+        (WebCore::InspectorBackend::setOuterHTML):
+        (WebCore::InspectorBackend::addInspectedNode):
+        (WebCore::InspectorBackend::clearConsoleMessages):
+        * inspector/InspectorBackend.h:
+        * inspector/InspectorBackend.idl:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::inspectedNode):
+        (WebCore::InspectorDOMAgent::changeTagName):
+        (WebCore::InspectorDOMAgent::getOuterHTML):
+        (WebCore::InspectorDOMAgent::setOuterHTML):
+        (WebCore::InspectorDOMAgent::addInspectedNode):
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorFrontend.cpp:
+        (WebCore::InspectorFrontend::didGetOuterHTML):
+        (WebCore::InspectorFrontend::didSetOuterHTML):
+        * inspector/InspectorFrontend.h:
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.requestClearMessages):
+        * inspector/front-end/DOMAgent.js:
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged):
+        (WebInspector.ElementsPanel):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback):
+        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted):
+        ():
+        * inspector/front-end/InjectedScript.js:
+        (injectedScriptConstructor):
+        * inspector/front-end/InjectedScriptAccess.js:
+
 2010-06-17  John Gregg  <johnnyg@google.com>
 
         Reviewed by David Levin.
index 4c3c7ae..727cd12 100644 (file)
@@ -123,6 +123,15 @@ long InjectedScriptHost::pushNodeByPathToFrontend(const String& path)
     return domAgent->pushNodePathToFrontend(node);
 }
 
+long InjectedScriptHost::inspectedNode(unsigned long num)
+{
+    InspectorDOMAgent* domAgent = inspectorDOMAgent();
+    if (!domAgent)
+        return 0;
+
+    return domAgent->inspectedNode(num);
+}
+
 #if ENABLE(DATABASE)
 Database* InjectedScriptHost::databaseForId(long databaseId)
 {
index 66cf41e..380d15f 100644 (file)
@@ -68,8 +68,8 @@ public:
     void copyText(const String& text);
     Node* nodeForId(long nodeId);
     long pushNodePathToFrontend(Node* node, bool withChildren, bool selectInUI);
-
     long pushNodeByPathToFrontend(const String& path);
+    long inspectedNode(unsigned long num);
 
 #if ENABLE(DATABASE)
     Database* databaseForId(long databaseId);
index 5a4ce19..a97e84d 100644 (file)
@@ -37,8 +37,8 @@ module core {
         void copyText(in DOMString text);
         [Custom] DOMObject nodeForId(in long nodeId);
         [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean withChildren, in boolean selectInUI);
-
         long pushNodeByPathToFrontend(in DOMString path);
+        long inspectedNode(in unsigned long num);
 
 #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
         [Custom] DOMObject currentCallFrame();
index 1eedda1..07140c9 100644 (file)
@@ -359,10 +359,28 @@ void InspectorBackend::removeNode(long callId, long nodeId)
         domAgent->removeNode(callId, nodeId);
 }
 
-void InspectorBackend::changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded)
+void InspectorBackend::changeTagName(long callId, long nodeId, const String& tagName)
 {
     if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
-        domAgent->changeTagName(callId, nodeId, tagName, expanded);
+        domAgent->changeTagName(callId, nodeId, tagName);
+}
+
+void InspectorBackend::getOuterHTML(long callId, long nodeId)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->getOuterHTML(callId, nodeId);
+}
+
+void InspectorBackend::setOuterHTML(long callId, long nodeId, const String& outerHTML)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->setOuterHTML(callId, nodeId, outerHTML);
+}
+
+void InspectorBackend::addInspectedNode(long nodeId)
+{
+    if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
+        domAgent->addInspectedNode(nodeId);
 }
 
 void InspectorBackend::performSearch(const String& query, bool runSynchronously)
@@ -377,6 +395,12 @@ void InspectorBackend::searchCanceled()
         domAgent->searchCanceled();
 }
 
+void InspectorBackend::clearConsoleMessages()
+{
+    if (m_inspectorController)
+        m_inspectorController->clearConsoleMessages();
+}
+
 void InspectorBackend::getStyles(long callId, long nodeId, bool authorOnly)
 {
     if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
index 61d73b8..a39ba50 100644 (file)
@@ -119,10 +119,15 @@ public:
     void getEventListenersForNode(long callId, long nodeId);
     void copyNode(long nodeId);
     void removeNode(long callId, long nodeId);
-    void changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded);
+    void changeTagName(long callId, long nodeId, const String& tagName);
+    void getOuterHTML(long callId, long nodeId);
+    void setOuterHTML(long callId, long nodeId, const String& outerHTML);
+    void addInspectedNode(long nodeId);
     void performSearch(const String& query, bool runSynchronously);
     void searchCanceled();
 
+    void clearConsoleMessages();
+
     void getStyles(long callId, long nodeId, bool authOnly);
     void getAllStyles(long callId);
     void getInlineStyle(long callId, long nodeId);
index c0078ee..6820171 100644 (file)
@@ -94,10 +94,15 @@ module core {
         void getEventListenersForNode(in long callId, in long nodeId);
         void copyNode(in long nodeId);
         void removeNode(in long callId, in long nodeId);
-        void changeTagName(in long callId, in long nodeId, in DOMString newTagName, in boolean expanded);
+        void changeTagName(in long callId, in long nodeId, in DOMString newTagName);
+        void getOuterHTML(in long callId, in long nodeId);
+        void setOuterHTML(in long callId, in long nodeId, in DOMString outerHTML);
+        void addInspectedNode(in long nodeId);
         void performSearch(in DOMString query, in boolean runSynchronously);
         void searchCanceled();
 
+        void clearConsoleMessages();
+
         void highlightDOMNode(in long nodeId);
         void hideDOMNodeHighlight();
 
index b152dc3..15fc2ea 100644 (file)
@@ -53,9 +53,9 @@
 #include "EventTarget.h"
 #include "Frame.h"
 #include "FrameTree.h"
+#include "HTMLElement.h"
 #include "HTMLFrameOwnerElement.h"
 #include "InspectorFrontend.h"
-#include "markup.h"
 #include "MutationEvent.h"
 #include "Node.h"
 #include "NodeList.h"
@@ -355,12 +355,20 @@ void InspectorDOMAgent::pushChildNodesToFrontend(long nodeId)
     m_frontend->setChildNodes(nodeId, children);
 }
 
+long InspectorDOMAgent::inspectedNode(unsigned long num)
+{
+    if (num < m_inspectedNodes.size())
+        return m_inspectedNodes[num];
+    return 0;
+}
+
 void InspectorDOMAgent::discardBindings()
 {
     m_documentNodeToIdMap.clear();
     m_idToNode.clear();
     releaseDanglingNodes();
     m_childrenRequested.clear();
+    m_inspectedNodes.clear();
 }
 
 Node* InspectorDOMAgent::nodeForId(long id)
@@ -481,40 +489,40 @@ void InspectorDOMAgent::removeNode(long callId, long nodeId)
 {
     Node* node = nodeForId(nodeId);
     if (!node) {
-        // Use -1 to denote an error condition.
-        m_frontend->didRemoveNode(callId, -1);
+        m_frontend->didRemoveNode(callId, 0);
         return;
     }
 
     Node* parentNode = node->parentNode();
     if (!parentNode) {
-        m_frontend->didRemoveNode(callId, -1);
+        m_frontend->didRemoveNode(callId, 0);
         return;
     }
 
-    ExceptionCode code;
-    parentNode->removeChild(node, code);
-    if (code) {
-        m_frontend->didRemoveNode(callId, -1);
+    ExceptionCode ec = 0;
+    parentNode->removeChild(node, ec);
+    if (ec) {
+        m_frontend->didRemoveNode(callId, 0);
         return;
     }
 
     m_frontend->didRemoveNode(callId, nodeId);
 }
 
-void InspectorDOMAgent::changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded)
+void InspectorDOMAgent::changeTagName(long callId, long nodeId, const String& tagName)
 {
     Node* oldNode = nodeForId(nodeId);
     if (!oldNode || !oldNode->isElementNode()) {
-        // Use -1 to denote an error condition.
-        m_frontend->didChangeTagName(callId, -1);
+        m_frontend->didChangeTagName(callId, 0);
         return;
     }
 
-    ExceptionCode code = 0;
-    RefPtr<Element> newElem = oldNode->document()->createElement(tagName, code);
-    if (code) {
-        m_frontend->didChangeTagName(callId, -1);
+    bool childrenRequested = m_childrenRequested.contains(nodeId);
+
+    ExceptionCode ec = 0;
+    RefPtr<Element> newElem = oldNode->document()->createElement(tagName, ec);
+    if (ec) {
+        m_frontend->didChangeTagName(callId, 0);
         return;
     }
 
@@ -527,24 +535,63 @@ void InspectorDOMAgent::changeTagName(long callId, long nodeId, const AtomicStri
     // Copy over the original node's children.
     Node* child;
     while ((child = oldNode->firstChild()))
-        newElem->appendChild(child, code);
+        newElem->appendChild(child, ec);
 
     // Replace the old node with the new node
     Node* parent = oldNode->parentNode();
-    parent->insertBefore(newElem, oldNode->nextSibling(), code);
-    parent->removeChild(oldNode, code);
+    parent->insertBefore(newElem, oldNode->nextSibling(), ec);
+    parent->removeChild(oldNode, ec);
 
-    if (code) {
-        m_frontend->didChangeTagName(callId, -1);
+    if (ec) {
+        m_frontend->didChangeTagName(callId, 0);
         return;
     }
 
     long newId = pushNodePathToFrontend(newElem.get());
-    if (expanded)
+    if (childrenRequested)
         pushChildNodesToFrontend(newId);
     m_frontend->didChangeTagName(callId, newId);
 }
 
+void InspectorDOMAgent::getOuterHTML(long callId, long nodeId)
+{
+    Node* node = nodeForId(nodeId);
+    if (!node || !node->isHTMLElement()) {
+        m_frontend->didGetOuterHTML(callId, "");
+        return;
+    }
+
+    HTMLElement* htmlElement = static_cast<HTMLElement*>(node);
+    m_frontend->didGetOuterHTML(callId, htmlElement->outerHTML());
+}
+
+void InspectorDOMAgent::setOuterHTML(long callId, long nodeId, const String& outerHTML)
+{
+    Node* node = nodeForId(nodeId);
+    if (!node || !node->isHTMLElement()) {
+        m_frontend->didSetOuterHTML(callId, 0);
+        return;
+    }
+
+    bool childrenRequested = m_childrenRequested.contains(nodeId);
+    Node* previousSibling = node->previousSibling();
+    Node* parentNode = node->parentNode();
+
+    HTMLElement* htmlElement = static_cast<HTMLElement*>(node);
+    ExceptionCode ec = 0;
+    htmlElement->setOuterHTML(outerHTML, ec);
+    if (ec)
+        m_frontend->didSetOuterHTML(callId, 0);
+
+    Node* newNode = previousSibling ? previousSibling->nextSibling() : parentNode->firstChild();
+
+    long newId = pushNodePathToFrontend(newNode);
+    if (childrenRequested)
+        pushChildNodesToFrontend(newId);
+
+    m_frontend->didSetOuterHTML(callId, newId);
+}
+
 void InspectorDOMAgent::setTextNodeValue(long callId, long nodeId, const String& value)
 {
     Node* node = nodeForId(nodeId);
@@ -632,6 +679,13 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId)
     m_frontend->didGetEventListenersForNode(callId, nodeId, listenersArray);
 }
 
+void InspectorDOMAgent::addInspectedNode(long nodeId)
+{
+    m_inspectedNodes.prepend(nodeId);
+    while (m_inspectedNodes.size() > 5)
+        m_inspectedNodes.removeLast();
+}
+
 void InspectorDOMAgent::performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously)
 {
     // FIXME: Few things are missing here:
index a962569..5962d4d 100644 (file)
@@ -102,9 +102,12 @@ namespace WebCore {
         void setAttribute(long callId, long elementId, const String& name, const String& value);
         void removeAttribute(long callId, long elementId, const String& name);
         void removeNode(long callId, long nodeId);
-        void changeTagName(long callId, long nodeId, const AtomicString& tagName, bool expanded);
+        void changeTagName(long callId, long nodeId, const String& tagName);
+        void getOuterHTML(long callId, long nodeId);
+        void setOuterHTML(long callId, long nodeId, const String& outerHTML);
         void setTextNodeValue(long callId, long nodeId, const String& value);
         void getEventListenersForNode(long callId, long nodeId);
+        void addInspectedNode(long nodeId);
         void performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously);
         void searchCanceled();
 
@@ -134,6 +137,7 @@ namespace WebCore {
         Node* nodeForPath(const String& path);
         long pushNodePathToFrontend(Node* node);
         void pushChildNodesToFrontend(long nodeId);
+        long inspectedNode(unsigned long num);
 
     private:
         static CSSStyleSheet* getParentStyleSheet(CSSStyleDeclaration*);
@@ -200,6 +204,7 @@ namespace WebCore {
         Deque<MatchJob*> m_pendingMatchJobs;
         Timer<InspectorDOMAgent> m_matchJobsTimer;
         HashSet<RefPtr<Node> > m_searchResults;
+        Vector<long> m_inspectedNodes;
     };
 
 } // namespace WebCore
index c9aa730..fad3303 100644 (file)
@@ -514,6 +514,24 @@ void InspectorFrontend::didChangeTagName(long callId, long nodeId)
     function.call();
 }
 
+void InspectorFrontend::didGetOuterHTML(long callId, const String& outerHTML)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didGetOuterHTML");
+    function.appendArgument(callId);
+    function.appendArgument(outerHTML);
+    function.call();
+}
+
+void InspectorFrontend::didSetOuterHTML(long callId, long nodeId)
+{
+    ScriptFunctionCall function(m_webInspector, "dispatch"); 
+    function.appendArgument("didSetOuterHTML");
+    function.appendArgument(callId);
+    function.appendArgument(nodeId);
+    function.call();
+}
+
 void InspectorFrontend::didGetChildNodes(long callId)
 {
     ScriptFunctionCall function(m_webInspector, "dispatch"); 
index 1762014..0e96688 100644 (file)
@@ -142,6 +142,8 @@ namespace WebCore {
         void didGetEventListenersForNode(long callId, long nodeId, const ScriptArray& listenersArray);
         void didRemoveNode(long callId, long nodeId);
         void didChangeTagName(long callId, long nodeId);
+        void didGetOuterHTML(long callId, const String& outerHTML);
+        void didSetOuterHTML(long callId, long nodeId);
 
         void didGetStyles(long callId, const ScriptValue& styles);
         void didGetAllStyles(long callId, const ScriptArray& styles);
index d1f347b..106324e 100644 (file)
@@ -296,7 +296,7 @@ WebInspector.ConsoleView.prototype = {
 
     requestClearMessages: function()
     {
-        InjectedScriptAccess.getDefault().clearConsoleMessages(function() {});
+        InspectorBackend.clearConsoleMessages();
     },
 
     clearMessages: function()
index 5bde12f..c35dce4 100644 (file)
@@ -669,6 +669,8 @@ WebInspector.didRemoveAttribute = WebInspector.Callback.processCallback;
 WebInspector.didSetTextNodeValue = WebInspector.Callback.processCallback;
 WebInspector.didRemoveNode = WebInspector.Callback.processCallback;
 WebInspector.didChangeTagName = WebInspector.Callback.processCallback;
+WebInspector.didGetOuterHTML = WebInspector.Callback.processCallback;
+WebInspector.didSetOuterHTML = WebInspector.Callback.processCallback;
 WebInspector.didGetEventListenersForNode = WebInspector.Callback.processCallback;
 
 WebInspector.didGetStyles = WebInspector.Callback.processCallback;
index 55ba82d..0be5680 100644 (file)
@@ -59,7 +59,7 @@ WebInspector.ElementsPanel = function()
         this.panel.updateEventListeners();
 
         if (this._focusedDOMNode)
-            InjectedScriptAccess.get(this._focusedDOMNode.injectedScriptId).addInspectedNode(this._focusedDOMNode.id, function() {});
+            InspectorBackend.addInspectedNode(this._focusedDOMNode.id);
     };
 
     this.contentElement.appendChild(this.treeOutline.element);
index e8fecb0..1b84b83 100644 (file)
@@ -1094,7 +1094,7 @@ WebInspector.ElementsTreeElement.prototype = {
 
         function changeTagNameCallback(nodeId)
         {
-            if (nodeId === -1) {
+            if (!nodeId) {
                 cancel();
                 return;
             }
@@ -1111,7 +1111,7 @@ WebInspector.ElementsTreeElement.prototype = {
         }
 
         var callId = WebInspector.Callback.wrap(changeTagNameCallback);
-        InspectorBackend.changeTagName(callId, this.representedObject.id, newText, wasExpanded);
+        InspectorBackend.changeTagName(callId, this.representedObject.id, newText);
     },
 
     _textNodeEditingCommitted: function(element, newText)
@@ -1382,10 +1382,12 @@ WebInspector.ElementsTreeElement.prototype = {
 
         function commitChange(value)
         {
-            InjectedScriptAccess.get(node.injectedScriptId).setOuterHTML(node.id, value, wasExpanded, selectNode.bind(this));
+            var setCallId = WebInspector.Callback.wrap(selectNode);
+            InspectorBackend.setOuterHTML(setCallId, node.id, value);
         }
 
-        InjectedScriptAccess.get(node.injectedScriptId).getNodePropertyValue(node.id, "outerHTML", this._startEditingAsHTML.bind(this, commitChange));
+        var getCallId = WebInspector.Callback.wrap(this._startEditingAsHTML.bind(this, commitChange));
+        InspectorBackend.getOuterHTML(getCallId, node.id);
     },
 
     _copyHTML: function()
index abbbab9..a8efa7f 100644 (file)
@@ -80,14 +80,6 @@ InjectedScript.releaseWrapperObjectGroup = function(objectGroupName) {
     delete InjectedScript.objectGroups[objectGroupName];
 };
 
-// Called from within InspectorController on the 'inspected page' side.
-InjectedScript.reset = function()
-{
-    InjectedScript._inspectedNodes = [];
-}
-
-InjectedScript.reset();
-
 InjectedScript.dispatch = function(methodName, args, callId)
 {
     var argsArray = eval("(" + args + ")");
@@ -219,29 +211,6 @@ InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression
     }
 }
 
-InjectedScript.getNodePropertyValue = function(nodeId, propertyName)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    var result = node[propertyName];
-    return result !== undefined ? result : false;
-}
-
-InjectedScript.setOuterHTML = function(nodeId, value, expanded)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-
-    var parent = node.parentNode;
-    var prevSibling = node.previousSibling;
-    node.outerHTML = value;
-    var newNode = prevSibling ? prevSibling.nextSibling : parent.firstChild;
-
-    return InjectedScriptHost.pushNodePathToFrontend(newNode, expanded, false);
-}
-
 InjectedScript._populatePropertyNames = function(object, resultSet)
 {
     for (var o = object; o; o = o.__proto__) {
@@ -343,19 +312,6 @@ InjectedScript._evaluateOn = function(evalFunction, object, expression, dontUseC
     return value;
 }
 
-InjectedScript.addInspectedNode = function(nodeId)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-
-    var inspectedNodes = InjectedScript._inspectedNodes;
-    inspectedNodes.unshift(node);
-    if (inspectedNodes.length >= 5)
-        inspectedNodes.pop();
-    return true;
-}
-
 InjectedScript.getNodeId = function(node)
 {
     return InjectedScriptHost.pushNodePathToFrontend(node, false, false);
@@ -400,17 +356,10 @@ InjectedScript._callFrameForId = function(id)
     return callFrame;
 }
 
-InjectedScript.clearConsoleMessages = function()
-{
-    InjectedScriptHost.clearConsoleMessages();
-    return true;
-}
-
 InjectedScript._resolveObject = function(objectProxy)
 {
     var object = InjectedScript._objectForId(objectProxy.objectId);
     var path = objectProxy.path;
-    var protoDepth = objectProxy.protoDepth;
 
     // Follow the property path.
     for (var i = 0; InjectedScript._isDefined(object) && path && i < path.length; ++i)
@@ -707,7 +656,13 @@ InjectedScript._normalizeEventTypes = function(types)
             result.push(types[i]);
     }
     return result;
-};
+}
+
+InjectedScript._inspectedNode = function(num)
+{
+    var nodeId = InjectedScriptHost.inspectedNode(num);
+    return InjectedScript._nodeForId(nodeId);
+}
 
 function CommandLineAPI()
 {
@@ -829,27 +784,27 @@ CommandLineAPI.prototype = {
 
     get $0()
     {
-        return InjectedScript._inspectedNodes[0];
+        return InjectedScript._inspectedNode(0);
     },
 
     get $1()
     {
-        return InjectedScript._inspectedNodes[1];
+        return InjectedScript._inspectedNode(1);
     },
 
     get $2()
     {
-        return InjectedScript._inspectedNodes[2];
+        return InjectedScript._inspectedNode(2);
     },
 
     get $3()
     {
-        return InjectedScript._inspectedNodes[3];
+        return InjectedScript._inspectedNode(3);
     },
 
     get $4()
     {
-        return InjectedScript._inspectedNodes[4];
+        return InjectedScript._inspectedNode(4);
     }
 }
 
index c388213..8ccc879 100644 (file)
@@ -70,18 +70,14 @@ InjectedScriptAccess._installHandler = function(methodName, async)
 // - Make sure corresponding methods in InjectedScript return non-null and non-undefined values,
 // - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function.
 // We keep these sorted.
-InjectedScriptAccess._installHandler("addInspectedNode");
-InjectedScriptAccess._installHandler("clearConsoleMessages");
 InjectedScriptAccess._installHandler("evaluate");
 InjectedScriptAccess._installHandler("evaluateInCallFrame");
 InjectedScriptAccess._installHandler("getCompletions");
-InjectedScriptAccess._installHandler("getNodePropertyValue");
 InjectedScriptAccess._installHandler("getProperties");
 InjectedScriptAccess._installHandler("getPrototypes");
 InjectedScriptAccess._installHandler("openInInspectedWindow");
 InjectedScriptAccess._installHandler("pushNodeToFrontend");
 InjectedScriptAccess._installHandler("nodeByPath");
-InjectedScriptAccess._installHandler("setOuterHTML");
 InjectedScriptAccess._installHandler("setPropertyValue");
 InjectedScriptAccess._installHandler("evaluateOnSelf");