2011-03-11 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Mar 2011 09:10:38 +0000 (09:10 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Mar 2011 09:10:38 +0000 (09:10 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: follow up to error reporting, fixing multiple regressions.
        https://bugs.webkit.org/show_bug.cgi?id=56243

        * inspector/elements/elements-panel-search.html:
2011-03-11  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: follow up to error reporting, fixing multiple regressions.
        https://bugs.webkit.org/show_bug.cgi?id=56243

        * inspector/InjectedScript.cpp:
        (WebCore::InjectedScript::setPropertyValue):
        * inspector/InjectedScript.h:
        * inspector/Inspector.idl:
        * inspector/InspectorDOMAgent.cpp:
        (WebCore::InspectorDOMAgent::getChildNodes):
        (WebCore::InspectorDOMAgent::getOuterHTML):
        (WebCore::InspectorDOMAgent::getEventListenersForNode):
        * inspector/InspectorDOMAgent.h:
        * inspector/InspectorRuntimeAgent.cpp:
        (WebCore::InspectorRuntimeAgent::setPropertyValue):
        * inspector/InspectorRuntimeAgent.h:
        * inspector/front-end/DOMAgent.js:
        (WebInspector.DOMNode.prototype.setNodeName):
        (WebInspector.DOMNode.prototype.setNodeValue):
        (WebInspector.DOMNode.prototype.getChildNodes):
        (WebInspector.DOMNode.prototype.getOuterHTML):
        (WebInspector.DOMNode.prototype.setOuterHTML):
        (WebInspector.DOMNode.prototype.removeNode):
        (WebInspector.DOMNode.prototype.copyNode):
        (WebInspector.DOMAgent.prototype.pushNodeToFrontend):
        (WebInspector.DOMAgent.prototype.pushNodeByPathToFrontend):
        (WebInspector.EventListeners.getEventListenersForNode):
        * inspector/front-end/DOMStorage.js:
        (WebInspector.DOMStorage.prototype.getEntries):
        (WebInspector.DOMStorage.prototype.setItem):
        (WebInspector.DOMStorage.prototype.removeItem):
        * inspector/front-end/DOMStorageItemsView.js:
        (WebInspector.DOMStorageItemsView.prototype.update):
        (WebInspector.DOMStorageItemsView.prototype._showDOMStorageEntries):
        * inspector/front-end/ElementsTreeOutline.js:
        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip):
        (WebInspector.ElementsTreeElement.prototype.updateChildren):
        ():
        * inspector/front-end/EventListenersSidebarPane.js:
        (WebInspector.EventListenersSidebarPane.prototype.update.callback):
        (WebInspector.EventListenersSidebarPane.prototype.update):
        * inspector/front-end/ObjectPropertiesSection.js:
        (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression.callback):
        (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression):
        * inspector/front-end/PropertiesSidebarPane.js:
        (WebInspector.PropertiesSidebarPane.prototype.update.nodeResolved):
        * inspector/front-end/RemoteObject.js:
        (WebInspector.RemoteObject.prototype.setPropertyValue):
        (WebInspector.RemoteObject.prototype.evaluate):
        * inspector/front-end/inspector.js:

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

27 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/elements-test.js
LayoutTests/inspector/elements/dom-agent-query-selector.html
LayoutTests/inspector/elements/elements-panel-search.html
LayoutTests/inspector/extensions/extensions-events.html
LayoutTests/inspector/protocol/runtime-agent-expected.txt
LayoutTests/inspector/timeline/timeline-test.js
Source/WebCore/ChangeLog
Source/WebCore/inspector/InjectedScript.cpp
Source/WebCore/inspector/InjectedScript.h
Source/WebCore/inspector/InjectedScriptSource.js
Source/WebCore/inspector/Inspector.idl
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMAgent.h
Source/WebCore/inspector/InspectorRuntimeAgent.cpp
Source/WebCore/inspector/InspectorRuntimeAgent.h
Source/WebCore/inspector/front-end/BreakpointManager.js
Source/WebCore/inspector/front-end/DOMAgent.js
Source/WebCore/inspector/front-end/DOMStorage.js
Source/WebCore/inspector/front-end/DOMStorageItemsView.js
Source/WebCore/inspector/front-end/ElementsTreeOutline.js
Source/WebCore/inspector/front-end/EventListenersSidebarPane.js
Source/WebCore/inspector/front-end/ExtensionAPISchema.json
Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
Source/WebCore/inspector/front-end/RemoteObject.js
Source/WebCore/inspector/front-end/inspector.js

index a5e664db9f6c039c3c8b9d389dfeca98ce2e0ad5..78c58336c13e2d8a926e8d52073f6085b77c833d 100644 (file)
@@ -1,3 +1,12 @@
+2011-03-11  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: follow up to error reporting, fixing multiple regressions.
+        https://bugs.webkit.org/show_bug.cgi?id=56243
+
+        * inspector/elements/elements-panel-search.html:
+
 2011-03-11  Anton D'Auria  <adauria@apple.com>
 
         Reviewed by Brady Eidson.
index 967c9b20d5141fff8b376f28d34d282ab514b40c..58bbf8fc09be8e579637298bf669e50434dfde0f 100755 (executable)
@@ -21,7 +21,7 @@ InspectorTest.nodeWithId = function(idValue, callback)
                 return;
             }
             pendingRequests++;
-            childNode.childNodes(processChildren.bind(null, false));
+            childNode.getChildNodes(processChildren.bind(null, false));
         }
 
         if (topLevel)
@@ -34,7 +34,7 @@ InspectorTest.nodeWithId = function(idValue, callback)
     WebInspector.domAgent.requestDocument(documentRequested.bind(this));
     function documentRequested(doc)
     {
-        doc.childNodes(processChildren.bind(this, true));
+        doc.getChildNodes(processChildren.bind(this, true));
     }
 };
 
index d21ea918ad79a594f4b97357e1ccf9e19bd43492..5634dd48e6ddcdf4a197055a0176c4271a0b4989 100644 (file)
@@ -38,15 +38,22 @@ function test()
 
     function dumpNodes(next, error, nodeIds)
     {
-        if (error)
-            InspectorTest.addRecord(error);
+        if (error) {
+            InspectorTest.addResult(error);
+            next();
+            return;
+        }
 
         if (!(nodeIds instanceof Array))
             nodeIds = [nodeIds];
 
         for (var i = 0; i < nodeIds.length; ++i) {
-            var node = WebInspector.domAgent.nodeForId(nodeIds[i]);
-            InspectorTest.addResult("node id: " + node.getAttribute("id"));
+            if (!nodeIds[i])
+                InspectorTest.addResult("no results");
+            else {
+                var node = WebInspector.domAgent.nodeForId(nodeIds[i]);
+                InspectorTest.addResult("node id: " + node.getAttribute("id"));
+            }
         }
         next();
     }
index d5b3ac09845f0912c13e51a00ecfd3a2bff4267b..4dbfe20a72fd3f1fb2be931d3e4ee3d39b15c034 100755 (executable)
@@ -8,8 +8,11 @@ function test()
     WebInspector.showPanel("elements");
 
     var searchResults = [];
-    function addSearchResult(markupValue)
+    function addSearchResult(error, markupValue)
     {
+        if (error)
+            return;
+
         if (markupValue.indexOf("ter" + "mi" + "nator") !== -1) {
             InspectorTest.addResult("====================================");
             InspectorTest.addResult("Results:");
@@ -27,7 +30,7 @@ function test()
             if (node.nodeType() === Node.TEXT_NODE)
                 searchResults.push(node.nodeValue());
             else
-                node.outerHTML(addSearchResult);
+                node.getOuterHTML(addSearchResult);
         }
     }
 
index 86c50e3d4741d00a96fcabf314b44433b8fe9115..e54e0c8cacee3c28a95c2ddb86a03917bc4232f2 100755 (executable)
@@ -46,7 +46,7 @@ function extension_testPageLoadEvents(nextTest)
             if (queuedOutput[i])
                 output(queuedOutput[i]);
         }
-       nextTest();
+        nextTest();
     }
 
     webInspector.inspectedWindow.onDOMContentLoaded.addListener(function(time) {
index afa8b7bb77d2ea8462d52e52486b4158f77f078e..37b51a2f0bde5fba32c181c121b5b530e9bf1a64 100644 (file)
@@ -80,9 +80,6 @@ request:
 response:
 {
     requestId : <number>
-    body : {
-        result : true
-    }
 }
 
 -----------------------------------------------------------
@@ -106,9 +103,6 @@ request:
 response:
 {
     requestId : <number>
-    body : {
-        result : true
-    }
 }
 
 -----------------------------------------------------------
index be097a9e5fc15651b9523081e611d83d260e56d4..0249d83b52367dcdd89bb603e70a47df96c3aa5e 100644 (file)
@@ -18,7 +18,7 @@ InspectorTest.timelineNonDeterministicProps = {
 InspectorTest.startTimeline = function(callback)
 {
     InspectorTest._timelineRecords = [];
-    TimelineAgent.start(errorFilter.bind(this, callback));
+    TimelineAgent.start(callback);
     function addRecord(record)
     {
         InspectorTest._timelineRecords.push(record);
@@ -30,7 +30,7 @@ InspectorTest.startTimeline = function(callback)
 
 InspectorTest.stopTimeline = function(callback)
 {
-    TimelineAgent.stop(errorFilter.bind(this, callback));
+    TimelineAgent.stop(callback);
 };
 
 InspectorTest.performActionsAndPrint = function(actions, typeName)
index b2fc2b298c8c5d276448a33157fb48ade0a443b4..619c65419916a6c5bd60797ce90bb0af8b7eef15 100644 (file)
@@ -1,3 +1,57 @@
+2011-03-11  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: follow up to error reporting, fixing multiple regressions.
+        https://bugs.webkit.org/show_bug.cgi?id=56243
+
+        * inspector/InjectedScript.cpp:
+        (WebCore::InjectedScript::setPropertyValue):
+        * inspector/InjectedScript.h:
+        * inspector/Inspector.idl:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::getChildNodes):
+        (WebCore::InspectorDOMAgent::getOuterHTML):
+        (WebCore::InspectorDOMAgent::getEventListenersForNode):
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorRuntimeAgent.cpp:
+        (WebCore::InspectorRuntimeAgent::setPropertyValue):
+        * inspector/InspectorRuntimeAgent.h:
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMNode.prototype.setNodeName):
+        (WebInspector.DOMNode.prototype.setNodeValue):
+        (WebInspector.DOMNode.prototype.getChildNodes):
+        (WebInspector.DOMNode.prototype.getOuterHTML):
+        (WebInspector.DOMNode.prototype.setOuterHTML):
+        (WebInspector.DOMNode.prototype.removeNode):
+        (WebInspector.DOMNode.prototype.copyNode):
+        (WebInspector.DOMAgent.prototype.pushNodeToFrontend):
+        (WebInspector.DOMAgent.prototype.pushNodeByPathToFrontend):
+        (WebInspector.EventListeners.getEventListenersForNode):
+        * inspector/front-end/DOMStorage.js:
+        (WebInspector.DOMStorage.prototype.getEntries):
+        (WebInspector.DOMStorage.prototype.setItem):
+        (WebInspector.DOMStorage.prototype.removeItem):
+        * inspector/front-end/DOMStorageItemsView.js:
+        (WebInspector.DOMStorageItemsView.prototype.update):
+        (WebInspector.DOMStorageItemsView.prototype._showDOMStorageEntries):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.setTooltip):
+        (WebInspector.ElementsTreeElement.prototype.updateChildren):
+        ():
+        * inspector/front-end/EventListenersSidebarPane.js:
+        (WebInspector.EventListenersSidebarPane.prototype.update.callback):
+        (WebInspector.EventListenersSidebarPane.prototype.update):
+        * inspector/front-end/ObjectPropertiesSection.js:
+        (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression.callback):
+        (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression):
+        * inspector/front-end/PropertiesSidebarPane.js:
+        (WebInspector.PropertiesSidebarPane.prototype.update.nodeResolved):
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject.prototype.setPropertyValue):
+        (WebInspector.RemoteObject.prototype.evaluate):
+        * inspector/front-end/inspector.js:
+
 2011-03-12  Jer Noble  <jer.noble@apple.com>
 
         Unreviewed build fix.
index 44bddfeea3de1e99c7490c435241db99a28de05d..5c8d67beeb47a459ff7ff6626d00bba5d968ecad 100644 (file)
@@ -107,13 +107,18 @@ void InjectedScript::resolveNode(long nodeId, RefPtr<InspectorValue>* result)
     makeCall(function, result);
 }
 
-void InjectedScript::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
+String InjectedScript::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression)
 {
     ScriptFunctionCall function(m_injectedScriptObject, "setPropertyValue");
     function.appendArgument(objectId->toJSONString());
     function.appendArgument(propertyName);
     function.appendArgument(expression);
-    makeCall(function, result);
+    RefPtr<InspectorValue> result;
+    makeCall(function, &result);
+
+    String error;
+    result->asString(&error);
+    return error;
 }
 
 void InjectedScript::releaseObject(PassRefPtr<InspectorObject> objectId)
index 96885512600b61c3ab4f7d89bbb28419f4c4fcbf..851c359b3b8b6fc9a5a4d7e08f10aa69d879dced 100644 (file)
@@ -57,9 +57,9 @@ public:
     void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
     Node* nodeForObjectId(PassRefPtr<InspectorObject> objectId);
     void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
-    void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
+    String setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression);
     void releaseObject(PassRefPtr<InspectorObject> objectId);
-    
+
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     PassRefPtr<InspectorValue> callFrames();
 #endif
index 5d383501a9a030fba0fbb249fc75a59bc2618d97..5454bf3e88ee68a289eb9c585168ef3b5ca9de93 100644 (file)
@@ -182,12 +182,12 @@ InjectedScript.prototype = {
         var parsedObjectId = this._parseObjectId(objectId);
         var object = this._objectForId(parsedObjectId);
         if (!this._isDefined(object))
-            return false;
+            return "Object with given id not found";
     
         var expressionLength = expression.length;
         if (!expressionLength) {
             delete object[propertyName];
-            return !(propertyName in object);
+            return propertyName in object ? "Cound not delete property." : undefined;
         }
     
         try {
@@ -200,14 +200,12 @@ InjectedScript.prototype = {
             var result = inspectedWindow.eval("(" + expression + ")");
             // Store the result in the property.
             object[propertyName] = result;
-            return true;
         } catch(e) {
             try {
                 var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\"");
                 object[propertyName] = result;
-                return true;
             } catch(e) {
-                return false;
+                return e.toString();
             }
         }
     },
index b0ca901c80dc19946ee19d997154a1e9c1fef1dd..3bfdcc189204107b368df0a5e8ff917aac851819 100644 (file)
@@ -67,7 +67,7 @@ module core {
         void evaluate(in String expression, in String objectGroup, in boolean includeCommandLineAPI, out Value result);
         void evaluateOn(in Object objectId, in String expression, out Value result);
         void getProperties(in Object objectId, in boolean ignoreHasOwnProperty, in boolean abbreviate, out Value result);
-        void setPropertyValue(in Object objectId, in String propertyName, in String expression, out Value result);
+        void setPropertyValue(in Object objectId, in String propertyName, in String expression);
         void releaseObject(in Object objectId);
         void releaseObjectGroup(in long injectedScriptId, in String objectGroup);
     };
@@ -137,10 +137,10 @@ module core {
 
     interface [Conditional=INSPECTOR] DOM {
         void getDocument(out Object root);
-        void childNodes(in long nodeId);
+        void getChildNodes(in long nodeId);
 
         void querySelector(in long nodeId, in String selectors, in boolean documentWide, out long elementId);
-        void querySelectorAll(in long nodeId, in String selectors, in boolean documentWide, out Array result);
+        void querySelectorAll(in long nodeId, in String selectors, in boolean documentWide, out Array nodeIds);
 
         void setNodeName(in long nodeId, in String name, out long outNodeId);
         void setNodeValue(in long nodeId, in String value, out boolean success);
@@ -149,10 +149,10 @@ module core {
         void setAttribute(in long elementId, in String name, in String value, out boolean success);
         void removeAttribute(in long elementId, in String name, out boolean success);
 
-        void getEventListenersForNode(in long nodeId, out long outNodeId, out Array listenersArray);
+        void getEventListenersForNode(in long nodeId, out Array listenersArray);
         void copyNode(in long nodeId);
 
-        void outerHTML(in long nodeId, out String outerHTML);
+        void getOuterHTML(in long nodeId, out String outerHTML);
         void setOuterHTML(in long nodeId, in String outerHTML, out long outNodeId);
 
         void performSearch(in String query, in boolean runSynchronously);
index 05d10023edbbb8bb577218d852e90d57d8e1f2cc..d876c28efac1cd7080861ee082f1f1963a5e073e 100644 (file)
@@ -427,37 +427,45 @@ Node* InspectorDOMAgent::nodeForId(long id)
     return 0;
 }
 
-void InspectorDOMAgent::childNodes(ErrorString*, long nodeId)
+void InspectorDOMAgent::getChildNodes(ErrorString*, long nodeId)
 {
     pushChildNodesToFrontend(nodeId);
 }
 
-void InspectorDOMAgent::querySelector(ErrorString*, long nodeId, const String& selectors, bool documentWide, long* elementId)
+void InspectorDOMAgent::querySelector(ErrorString* errorString, long nodeId, const String& selectors, bool documentWide, long* elementId)
 {
     *elementId = 0;
     Node* node = nodeToSelectOn(nodeId, documentWide);
-    if (!node)
+    if (!node) {
+        *errorString = "Node with given id not found.";
         return;
+    }
 
     ExceptionCode ec = 0;
     RefPtr<Element> element = node->querySelector(selectors, ec);
-    if (ec)
+    if (ec) {
+        *errorString = "DOM Error while querying.";
         return;
+    }
 
     if (element)
         *elementId = pushNodePathToFrontend(element.get());
 }
 
-void InspectorDOMAgent::querySelectorAll(ErrorString*, long nodeId, const String& selectors, bool documentWide, RefPtr<InspectorArray>* result)
+void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, long nodeId, const String& selectors, bool documentWide, RefPtr<InspectorArray>* result)
 {
     Node* node = nodeToSelectOn(nodeId, documentWide);
-    if (!node)
+    if (!node) {
+        *errorString = "Node with given id not found.";
         return;
+    }
 
     ExceptionCode ec = 0;
     RefPtr<NodeList> nodes = node->querySelectorAll(selectors, ec);
-    if (ec)
+    if (ec) {
+        *errorString = "DOM Error while querying.";
         return;
+    }
 
     for (unsigned i = 0; i < nodes->length(); ++i)
         (*result)->pushNumber(pushNodePathToFrontend(nodes->item(i)));
@@ -591,7 +599,7 @@ void InspectorDOMAgent::setNodeName(ErrorString*, long nodeId, const String& tag
         pushChildNodesToFrontend(*newId);
 }
 
-void InspectorDOMAgent::outerHTML(ErrorString*, long nodeId, WTF::String* outerHTML)
+void InspectorDOMAgent::getOuterHTML(ErrorString*, long nodeId, WTF::String* outerHTML)
 {
     Node* node = nodeForId(nodeId);
     if (!node || !node->isHTMLElement())
@@ -651,10 +659,9 @@ void InspectorDOMAgent::setNodeValue(ErrorString*, long nodeId, const String& va
     *success = false;
 }
 
-void InspectorDOMAgent::getEventListenersForNode(ErrorString*, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray)
+void InspectorDOMAgent::getEventListenersForNode(ErrorString*, long nodeId, RefPtr<InspectorArray>* listenersArray)
 {
     Node* node = nodeForId(nodeId);
-    *outNodeId = nodeId;
     EventTargetData* d;
 
     // Quick break if a null node or no listeners at all
index 32a95cd0d23d65df1a2cad358c4c30c760e63366..c1817041b77ebc93b1140198213dba639fefbb7e 100644 (file)
@@ -109,15 +109,15 @@ public:
     void querySelector(ErrorString*, long nodeId, const String& selectors, bool documentWide, long* elementId);
     void querySelectorAll(ErrorString*, long nodeId, const String& selectors, bool documentWide, RefPtr<InspectorArray>* result);
     void getDocument(ErrorString*, RefPtr<InspectorObject>* root);
-    void childNodes(ErrorString*, long nodeId);
+    void getChildNodes(ErrorString*, long nodeId);
     void setAttribute(ErrorString*, long elementId, const String& name, const String& value, bool* success);
     void removeAttribute(ErrorString*, long elementId, const String& name, bool* success);
     void removeNode(ErrorString*, long nodeId, long* outNodeId);
     void setNodeName(ErrorString*, long nodeId, const String& name, long* newId);
-    void outerHTML(ErrorString*, long nodeId, WTF::String* outerHTML);
+    void getOuterHTML(ErrorString*, long nodeId, WTF::String* outerHTML);
     void setOuterHTML(ErrorString*, long nodeId, const String& outerHTML, long* newId);
     void setNodeValue(ErrorString*, long nodeId, const String& value, bool* success);
-    void getEventListenersForNode(ErrorString*, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray);
+    void getEventListenersForNode(ErrorString*, long nodeId, RefPtr<InspectorArray>* listenersArray);
     void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, bool runSynchronously);
     void searchCanceled(ErrorString*);
     void resolveNode(ErrorString*, long nodeId, const String& objectGroup, RefPtr<InspectorValue>* result);
index 75e210558e98bf09d2ba1e771659cbaf488bf61e..e7a325b0429f2ff614a411e32a2c934c07d74b06 100644 (file)
@@ -79,11 +79,13 @@ void InspectorRuntimeAgent::getProperties(ErrorString*, PassRefPtr<InspectorObje
         injectedScript.getProperties(objectId, ignoreHasOwnProperty, abbreviate, result);
 }
 
-void InspectorRuntimeAgent::setPropertyValue(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::setPropertyValue(ErrorString* errorString, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression)
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId.get());
     if (!injectedScript.hasNoValue())
-        injectedScript.setPropertyValue(objectId, propertyName, expression, result);
+        *errorString = injectedScript.setPropertyValue(objectId, propertyName, expression);
+    else
+        *errorString = "No injected script found.";
 }
 
 void InspectorRuntimeAgent::releaseObject(ErrorString*, PassRefPtr<InspectorObject> objectId)
index 30665203b49e87a356b4d1cb50532b5cf470c8c2..ad3ce5b3cc2bc6fecd3a0af86bfcca356e3fffe5 100644 (file)
@@ -56,7 +56,7 @@ public:
     void evaluateOn(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& expression, RefPtr<InspectorValue>* result);
     void releaseObject(ErrorString*, PassRefPtr<InspectorObject> objectId);
     void getProperties(ErrorString*, PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
-    void setPropertyValue(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
+    void setPropertyValue(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression);
     void releaseObjectGroup(ErrorString*, long injectedScriptId, const String& objectGroup);
 
 private:
index b62820ebb049d0d105be274878ddd57c41a423f7..bb5c8b5dd1bd4c0b22dde08d90f817689d551c95 100644 (file)
@@ -487,7 +487,7 @@ WebInspector.DOMBreakpointView.prototype = {
                 if (!targetNodeId)
                     return;
 
-                RuntimeAgent.releaseObject(eventData.targetNode);
+                eventData.targetNode.release();
                 var targetNode = WebInspector.panels.elements.linkifyNodeById(targetNodeId);
                 if (eventData.insertion) {
                     if (targetNodeId !== this._nodeId)
index 50021cc9d9170e7eb5884cfd549aafdde22e73db..3947f0036d8f2253268cb08c237c5c0ede8c9b29 100644 (file)
@@ -104,7 +104,7 @@ WebInspector.DOMNode.prototype = {
 
     setNodeName: function(name, callback)
     {
-        DOMAgent.setNodeName(this.id, name, errorFilter.bind(null, callback));
+        DOMAgent.setNodeName(this.id, name, callback);
     },
 
     localName: function()
@@ -119,7 +119,7 @@ WebInspector.DOMNode.prototype = {
 
     setNodeValue: function(value, callback)
     {
-        DOMAgent.setNodeValue(this.id, value, errorFilter.bind(null, callback));
+        DOMAgent.setNodeValue(this.id, value, callback);
     },
 
     getAttribute: function(name)
@@ -172,7 +172,7 @@ WebInspector.DOMNode.prototype = {
         DOMAgent.removeAttribute(this.id, name, mycallback.bind(this));
     },
 
-    childNodes: function(callback)
+    getChildNodes: function(callback)
     {
         if (this.children) {
             if (callback)
@@ -184,27 +184,27 @@ WebInspector.DOMNode.prototype = {
             if (!error && callback)
                 callback(this.children);
         }
-        DOMAgent.childNodes(this.id, mycallback.bind(this));
+        DOMAgent.getChildNodes(this.id, mycallback.bind(this));
     },
 
-    outerHTML: function(callback)
+    getOuterHTML: function(callback)
     {
-        DOMAgent.outerHTML(this.id, errorFilter.bind(null, callback));
+        DOMAgent.getOuterHTML(this.id, callback);
     },
 
     setOuterHTML: function(html, callback)
     {
-        DOMAgent.setOuterHTML(this.id, html, errorFilter.bind(null, callback));
+        DOMAgent.setOuterHTML(this.id, html, callback);
     },
 
     removeNode: function(callback)
     {
-        DOMAgent.removeNode(this.id, errorFilter.bind(null, callback));
+        DOMAgent.removeNode(this.id, callback);
     },
 
     copyNode: function(callback)
     {
-        DOMAgent.copyNode(this.id, errorFilter.bind(null, callback));
+        DOMAgent.copyNode(this.id, callback);
     },
 
     path: function()
@@ -354,28 +354,37 @@ WebInspector.DOMAgent.prototype = {
 
     pushNodeToFrontend: function(objectId, callback)
     {
+        function callbackWrapper(error, nodeId)
+        {
+            if (callback)
+                callback(error ? 0 : nodeId);
+        }
+
         function mycallback()
         {
             if (this._document)
-                DOMAgent.pushNodeToFrontend(objectId, errorFilter.bind(null, callback));
-            else {
-                if (callback)
-                    callback(0);
-            }
+                DOMAgent.pushNodeToFrontend(objectId, callbackWrapper);
+            else
+                callbackWrapper("No document");
         }
+
         this.requestDocument(mycallback.bind(this));
     },
 
     pushNodeByPathToFrontend: function(path, callback)
     {
+        function callbackWrapper(error, nodeId)
+        {
+            if (callback)
+                callback(error ? 0 : nodeId);
+        }
+
         function mycallback()
         {
             if (this._document)
-                DOMAgent.pushNodeByPathToFrontend(path, errorFilter.bind(null, callback));
-            else {
-                if (callback)
-                    callback(0);
-            }
+                DOMAgent.pushNodeByPathToFrontend(path, callbackWrapper);
+            else
+                callbackWrapper("No document");
         }
         this.requestDocument(mycallback.bind(this));
     },
@@ -635,9 +644,9 @@ WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain,
 
 WebInspector.EventListeners = {}
 
-WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callback)
+WebInspector.EventListeners.getEventListenersForNode = function(node, callback)
 {
     if (!node)
         return;
-    DOMAgent.getEventListenersForNode(node.id, errorFilter.bind(this, callback));
+    DOMAgent.getEventListenersForNode(node.id, callback);
 }
index 8579ba5c8edabf8e4287c96d1a65db95f04bdaf9..ea24921f6d16eea560d12219ce27f14a8b258302 100644 (file)
@@ -51,17 +51,17 @@ WebInspector.DOMStorage.prototype = {
 
     getEntries: function(callback)
     {
-        DOMStorageAgent.getDOMStorageEntries(this._id, errorFilter.bind(null, callback));
+        DOMStorageAgent.getDOMStorageEntries(this._id, callback);
     },
     
     setItem: function(key, value, callback)
     {
-        DOMStorageAgent.setDOMStorageItem(this._id, key, value, errorFilter.bind(null, callback));
+        DOMStorageAgent.setDOMStorageItem(this._id, key, value, callback);
     },
     
     removeItem: function(key, callback)
     {
-        DOMStorageAgent.removeDOMStorageItem(this._id, key, errorFilter.bind(null, callback));
+        DOMStorageAgent.removeDOMStorageItem(this._id, key, callback);
     }
 }
 
index dbd736bf69e8858615b79250edf83bcd55422f03..b63bc96ce4ce49a315ba3e6ffcb5585c3e33ce56 100644 (file)
@@ -61,12 +61,14 @@ WebInspector.DOMStorageItemsView.prototype = {
     update: function()
     {
         this.element.removeChildren();
-        var callback = this._showDOMStorageEntries.bind(this);
-        this.domStorage.getEntries(callback);
+        this.domStorage.getEntries(this._showDOMStorageEntries.bind(this));
     },
 
-    _showDOMStorageEntries: function(entries)
+    _showDOMStorageEntries: function(error, entries)
     {
+        if (error)
+            return;
+
         this._dataGrid = this._dataGridForDOMStorageEntries(entries);
         this.element.appendChild(this._dataGrid.element);
         this._dataGrid.autoSizeColumns(10);
index 6c9cd700b95d1412fe2ff389f996ae76b5bfaf72..b1de95e278f7b96b43bd8403a131d3572f4d068c 100644 (file)
@@ -406,9 +406,9 @@ WebInspector.ElementsTreeElement.prototype = {
         if (!node.nodeName() || node.nodeName().toLowerCase() !== "img")
             return;
 
-        function setTooltip(result)
+        function setTooltip(error, result)
         {
-            if (!result || result.type !== "string")
+            if (error || !result || result.type !== "string")
                 return;
 
             try {
@@ -426,15 +426,16 @@ WebInspector.ElementsTreeElement.prototype = {
             }
         }
 
-        function resolvedNode(error, objectPayload)
+        function resolvedNode(objectPayload)
         {
-            if (error || !objectPayload)
+            if (!objectPayload)
                 return;
 
             var object = WebInspector.RemoteObject.fromPayload(objectPayload);
             object.evaluate("return '[' + this.offsetWidth + ',' + this.offsetHeight + ',' + this.naturalWidth + ',' + this.naturalHeight + ']'", setTooltip.bind(this));
+            object.release();
         }
-        DOMAgent.resolveNode(node.id, "", resolvedNode.bind(this));
+        WebInspector.RemoteObject.resolveNode(node, resolvedNode.bind(this));
     },
 
     updateSelection: function()
@@ -492,7 +493,7 @@ WebInspector.ElementsTreeElement.prototype = {
     {
         if (this._elementCloseTag)
             return;
-        this.representedObject.childNodes(this._updateChildren.bind(this, fullRefresh));
+        this.representedObject.getChildNodes(this._updateChildren.bind(this, fullRefresh));
     },
 
     insertChildElement: function(child, index, closingTag)
@@ -1420,7 +1421,7 @@ WebInspector.ElementsTreeElement.prototype = {
             return;
 
         var self = this;
-        function removeNodeCallback(removedNodeId)
+        function removeNodeCallback(error, removedNodeId)
         {
             // -1 is an error code, which means removing the node from the DOM failed,
             // so we shouldn't remove it from the tree.
@@ -1461,7 +1462,7 @@ WebInspector.ElementsTreeElement.prototype = {
             node.setOuterHTML(value, selectNode);
         }
 
-        node.outerHTML(this._startEditingAsHTML.bind(this, commitChange));
+        node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange));
     },
 
     _copyHTML: function()
index 03275109ebe03b69dc1855b62b64a83082b2f3a3..a91899916d581e65837ccd899af1e47e0a67c610 100644 (file)
@@ -65,7 +65,10 @@ WebInspector.EventListenersSidebarPane.prototype = {
         this.sections = [];
 
         var self = this;
-        function callback(nodeId, eventListeners) {
+        function callback(error, eventListeners) {
+            if (error)
+                return;
+
             var sectionNames = [];
             var sectionMap = {};
             for (var i = 0; i < eventListeners.length; ++i) {
@@ -77,7 +80,7 @@ WebInspector.EventListenersSidebarPane.prototype = {
                 var type = eventListener.type;
                 var section = sectionMap[type];
                 if (!section) {
-                    section = new WebInspector.EventListenersSection(type, nodeId);
+                    section = new WebInspector.EventListenersSection(type, node.id);
                     sectionMap[type] = section;
                     sectionNames.push(type);
                     self.sections.push(section);
@@ -101,7 +104,7 @@ WebInspector.EventListenersSidebarPane.prototype = {
             }
         }
 
-        WebInspector.EventListeners.getEventListenersForNodeAsync(node, callback);
+        WebInspector.EventListeners.getEventListenersForNode(node, callback);
     },
 
     _changeSetting: function(event)
index 28084ba902e0c266676b1df5e23e4833c495b2fe..d9e6d18a80f124770925b6ba5f2795c8bfbce5c9 100755 (executable)
               }
             ]
           }
-               ]
+        ]
       },
       {
         "id": "ExtensionSidebarPane",
index 4bfdf899b495ceaecb6c1374447312de61e0915b..1795843e8f8fb8274902ce51a8e0aa0eb74760c8 100644 (file)
@@ -278,23 +278,23 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
     {
         expression = expression.trim();
         var expressionLength = expression.length;
-        var self = this;
-        var callback = function(success) {
+        function callback(error)
+        {
             if (!updateInterface)
                 return;
 
-            if (!success)
-                self.update();
+            if (error)
+                this.update();
 
             if (!expressionLength) {
                 // The property was deleted, so remove this tree element.
-                self.parent.removeChild(this);
+                this.parent.removeChild(this);
             } else {
                 // Call updateSiblings since their value might be based on the value that just changed.
-                self.updateSiblings();
+                this.updateSiblings();
             }
         };
-        this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback);
+        this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback.bind(this));
     }
 }
 
index 0c314bc451fb1d4a897287a95b3aa1f374941209..fc7c1b5cbea33d5ec4e944af5a9d5a479b081789 100644 (file)
@@ -53,9 +53,9 @@ WebInspector.PropertiesSidebarPane.prototype = {
             object.evaluate("var proto = this; result = {}; var counter = 1; while (proto) { result[counter++] = proto; proto = proto.__proto__ }; return result;", nodePrototypesReady.bind(this));
         }
 
-        function nodePrototypesReady(objectPayload)
+        function nodePrototypesReady(error, objectPayload)
         {
-            if (!objectPayload)
+            if (error || !objectPayload)
                 return;
             var object = WebInspector.RemoteObject.fromPayload(objectPayload);
             object.getOwnProperties(false, fillSection.bind(this));
index 4e933c93be1a94f972685005bbac525ce2f58f18..daee443bc4981136303f3601ae62141d073a1604 100644 (file)
@@ -50,9 +50,13 @@ WebInspector.RemoteObject.resolveNode = function(node, callback)
 {
     function mycallback(error, object)
     {
-        if (error)
+        if (!callback)
             return;
-        callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
+
+        if (error || !object)
+            callback(null);
+        else
+            callback(WebInspector.RemoteObject.fromPayload(object));
     }
     DOMAgent.resolveNode(node.id, "dom-selection", mycallback);
 }
@@ -128,10 +132,10 @@ WebInspector.RemoteObject.prototype = {
     setPropertyValue: function(name, value, callback)
     {
         if (!this._objectId) {
-            callback(false);
+            callback("Can't get a property of non-object.");
             return;
         }
-        RuntimeAgent.setPropertyValue(this._objectId, name, value, errorFilter.bind(this, callback));
+        RuntimeAgent.setPropertyValue(this._objectId, name, value, callback);
     },
 
     pushNodeToFrontend: function(callback)
@@ -144,7 +148,12 @@ WebInspector.RemoteObject.prototype = {
 
     evaluate: function(expression, callback)
     {
-        RuntimeAgent.evaluateOn(this._objectId, expression, errorFilter.bind(this, callback));
+        RuntimeAgent.evaluateOn(this._objectId, expression, callback);
+    },
+
+    release: function()
+    {
+        RuntimeAgent.releaseObject(this._objectId);
     }
 }
 
index 0a45325a9fa8f61e28ffd3ecee58576da7094faa..4e5f502657740b76cb9e3ade9bc1ee8a4bca8bd3 100644 (file)
     (new Image()).src = "Images/undockButtonGlyph.png";
 })();
 
-function errorFilter()
-{
-    var args = Array.prototype.slice.call(arguments);
-    var callback = args.shift();
-    var error = args.shift();
-    if (!error)
-        callback.apply(this, args);
-}
-
 var WebInspector = {
     resources: {},
     missingLocalizedStrings: {},
@@ -1201,7 +1192,7 @@ WebInspector.inspect = function(objectId, hints)
         WebInspector.panels.resources.selectDOMStorage(hints.domStorageId);
     }
 
-    RuntimeAgent.releaseObject(objectId);
+    object.release();
 }
 
 WebInspector.updateFocusedNode = function(nodeId)