2011-03-11 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2011 13:38:07 +0000 (13:38 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2011 13:38:07 +0000 (13:38 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: introduce error argument for all the callbacks on frontend.
        https://bugs.webkit.org/show_bug.cgi?id=56100

        * inspector/CodeGeneratorInspector.pm:
        * inspector/front-end: number of files

2011-03-11  Ilya Tikhonovsky  <loislo@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: introduce error argument for all the callbacks on frontend.
        https://bugs.webkit.org/show_bug.cgi?id=56100

        * http/tests/inspector/extensions-test.js:
        (initialize_ExtensionsTest.InspectorTest.runExtensionTests):
        * http/tests/inspector/inspector-test.js:
        (initialize_InspectorTest.InspectorTest.evaluateInPage.mycallback):
        (initialize_InspectorTest.InspectorTest.evaluateInPage):
        * inspector/console/console-dir-global.html:
        * inspector/elements/dom-agent-query-selector.html:
        * inspector/protocol/console-agent-expected.txt:
        * inspector/protocol/console-agent.html:
        * inspector/protocol/runtime-agent-expected.txt:
        * inspector/protocol/runtime-agent.html:
        * inspector/report-protocol-errors-expected.txt:
        * inspector/report-protocol-errors.html:
        * inspector/styles/styles-new-API.html:
        * inspector/styles/styles-source-offsets.html:
        * inspector/timeline/timeline-test.js:
        (initialize_Timeline.InspectorTest.stopTimeline):

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

34 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/extensions-test.js
LayoutTests/http/tests/inspector/inspector-test.js
LayoutTests/inspector/console/console-dir-global.html
LayoutTests/inspector/elements/dom-agent-query-selector.html
LayoutTests/inspector/protocol/console-agent-expected.txt
LayoutTests/inspector/protocol/console-agent.html
LayoutTests/inspector/protocol/runtime-agent-expected.txt
LayoutTests/inspector/protocol/runtime-agent.html
LayoutTests/inspector/report-protocol-errors-expected.txt
LayoutTests/inspector/report-protocol-errors.html
LayoutTests/inspector/styles/styles-new-API.html
LayoutTests/inspector/styles/styles-source-offsets.html
LayoutTests/inspector/timeline/timeline-test.js
Source/WebCore/ChangeLog
Source/WebCore/inspector/CodeGeneratorInspector.pm
Source/WebCore/inspector/front-end/AuditRules.js
Source/WebCore/inspector/front-end/CSSStyleModel.js
Source/WebCore/inspector/front-end/ConsoleView.js
Source/WebCore/inspector/front-end/DOMAgent.js
Source/WebCore/inspector/front-end/DOMStorage.js
Source/WebCore/inspector/front-end/Database.js
Source/WebCore/inspector/front-end/DebuggerModel.js
Source/WebCore/inspector/front-end/ElementsPanel.js
Source/WebCore/inspector/front-end/ElementsTreeOutline.js
Source/WebCore/inspector/front-end/ExtensionPanel.js
Source/WebCore/inspector/front-end/ExtensionServer.js
Source/WebCore/inspector/front-end/NetworkManager.js
Source/WebCore/inspector/front-end/ProfileView.js
Source/WebCore/inspector/front-end/ProfilesPanel.js
Source/WebCore/inspector/front-end/RemoteObject.js
Source/WebCore/inspector/front-end/Script.js
Source/WebCore/inspector/front-end/ScriptsPanel.js
Source/WebCore/inspector/front-end/inspector.js

index c584192..086ed1d 100644 (file)
@@ -1,3 +1,28 @@
+2011-03-11  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: introduce error argument for all the callbacks on frontend.
+        https://bugs.webkit.org/show_bug.cgi?id=56100
+
+        * http/tests/inspector/extensions-test.js:
+        (initialize_ExtensionsTest.InspectorTest.runExtensionTests):
+        * http/tests/inspector/inspector-test.js:
+        (initialize_InspectorTest.InspectorTest.evaluateInPage.mycallback):
+        (initialize_InspectorTest.InspectorTest.evaluateInPage):
+        * inspector/console/console-dir-global.html:
+        * inspector/elements/dom-agent-query-selector.html:
+        * inspector/protocol/console-agent-expected.txt:
+        * inspector/protocol/console-agent.html:
+        * inspector/protocol/runtime-agent-expected.txt:
+        * inspector/protocol/runtime-agent.html:
+        * inspector/report-protocol-errors-expected.txt:
+        * inspector/report-protocol-errors.html:
+        * inspector/styles/styles-new-API.html:
+        * inspector/styles/styles-source-offsets.html:
+        * inspector/timeline/timeline-test.js:
+        (initialize_Timeline.InspectorTest.stopTimeline):
+
 2011-03-11  Yury Semikhatsky  <yurys@chromium.org>
 
         Reviewed by Pavel Feldman.
index fa229b5..f1cc016 100644 (file)
@@ -34,7 +34,9 @@ InspectorTest.dispatchOnMessage = function(messageId, callback, recurring)
 
 InspectorTest.runExtensionTests = function()
 {
-    RuntimeAgent.evaluate("location.href", "console", false, function(result) {
+    RuntimeAgent.evaluate("location.href", "console", false, function(error, result) {
+        if (error)
+            return;
         var pageURL = result.description;
         var extensionURL = (/^https?:/.test(pageURL) ?
             pageURL.replace(/^(https?:\/\/[^/]*\/).*$/,"$1") :
index 4fa4e9f..c507f59 100644 (file)
@@ -48,9 +48,10 @@ InspectorTest.evaluateInPage = function(code, callback)
 {
     callback = InspectorTest.safeWrap(callback);
 
-    function mycallback(result)
+    function mycallback(error, result)
     {
-        callback(WebInspector.RemoteObject.fromPayload(result));
+        if (!error)
+            callback(WebInspector.RemoteObject.fromPayload(result));
     }
     RuntimeAgent.evaluate(code, "console", false, mycallback);
 }
index 7563093..4499691 100644 (file)
@@ -14,8 +14,12 @@ function test()
 {
     RuntimeAgent.evaluate("window", "console", false, evalCallback);
 
-    function evalCallback(result)
+    function evalCallback(error, result)
     {
+        if (error) {
+            testController.notifyDone("Exception:" + error);
+            return;
+        }
         if (result.type === "error")
             testController.notifyDone("Exception:" + result);
         var objectProxy = WebInspector.RemoteObject.fromPayload(result);
index 159fab6..d21ea91 100644 (file)
@@ -36,8 +36,11 @@ function test()
         ]);
     }
 
-    function dumpNodes(next, nodeIds)
+    function dumpNodes(next, error, nodeIds)
     {
+        if (error)
+            InspectorTest.addRecord(error);
+
         if (!(nodeIds instanceof Array))
             nodeIds = [nodeIds];
 
index c58afad..8968f44 100644 (file)
@@ -7,7 +7,7 @@ ConsoleAgent.setConsoleMessagesEnabled(false)
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Console"
     command : "setConsoleMessagesEnabled"
     arguments : {
@@ -17,7 +17,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         newState : false
     }
@@ -28,7 +28,7 @@ ConsoleAgent.setConsoleMessagesEnabled(true)
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Console"
     command : "setConsoleMessagesEnabled"
     arguments : {
@@ -38,7 +38,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         newState : true
     }
@@ -49,7 +49,7 @@ RuntimeAgent.evaluate("console.info('test'); console.info('test')","test-group",
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "evaluate"
     arguments : {
@@ -96,7 +96,7 @@ event ConsoleAgent.updateConsoleMessageRepeatCount
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         result : {
             type : "undefined"
@@ -110,7 +110,7 @@ ConsoleAgent.clearConsoleMessages()
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Console"
     command : "clearConsoleMessages"
     arguments : {
@@ -128,7 +128,7 @@ event ConsoleAgent.consoleMessagesCleared
 
 response:
 {
-    seq : <number>
+    requestId : <number>
 }
 
 -----------------------------------------------------------
@@ -136,7 +136,7 @@ ConsoleAgent.setMonitoringXHREnabled(false)
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Console"
     command : "setMonitoringXHREnabled"
     arguments : {
@@ -146,7 +146,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
 }
 
 -----------------------------------------------------------
@@ -154,7 +154,7 @@ ConsoleAgent.setMonitoringXHREnabled(true)
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Console"
     command : "setMonitoringXHREnabled"
     arguments : {
@@ -164,7 +164,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
 }
 
 -----------------------------------------------------------
@@ -172,7 +172,7 @@ ConsoleAgent.addInspectedNode(<number>)
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Console"
     command : "addInspectedNode"
     arguments : {
@@ -182,7 +182,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
 }
 
 ===========================================================
index 36da4e9..7597444 100644 (file)
@@ -16,7 +16,7 @@ function test()
         ["ConsoleAgent", "addInspectedNode", 1]
     ];
 
-    InspectorTest.runProtocolTestSuite("ConsoleAgent", testSuite, ['seq', 'id', 'injectedScriptId', 'stackTrace']);
+    InspectorTest.runProtocolTestSuite("ConsoleAgent", testSuite, ['id', 'requestId', 'injectedScriptId', 'stackTrace']);
 }
 
 </script>
index 5e607c7..afa8b7b 100644 (file)
@@ -5,7 +5,7 @@ RuntimeAgent.evaluate("testObject","test",false)
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "evaluate"
     arguments : {
@@ -17,7 +17,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         result : {
             objectId : {
@@ -36,7 +36,7 @@ RuntimeAgent.evaluateOn({"injectedScriptId":<number>,"id":<number>},"this.assign
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "evaluateOn"
     arguments : {
@@ -50,7 +50,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         result : {
             type : "undefined"
@@ -64,7 +64,7 @@ RuntimeAgent.setPropertyValue({"injectedScriptId":<number>,"id":<number>},"assig
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "setPropertyValue"
     arguments : {
@@ -79,7 +79,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         result : true
     }
@@ -90,7 +90,7 @@ RuntimeAgent.setPropertyValue({"injectedScriptId":<number>,"id":<number>},"remov
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "setPropertyValue"
     arguments : {
@@ -105,7 +105,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         result : true
     }
@@ -116,7 +116,7 @@ RuntimeAgent.getProperties({"injectedScriptId":<number>,"id":<number>},false,fal
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "getProperties"
     arguments : {
@@ -131,7 +131,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
     body : {
         result : {
             0 : {
@@ -169,7 +169,7 @@ RuntimeAgent.releaseObject({"injectedScriptId":<number>,"id":<number>})
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "releaseObject"
     arguments : {
@@ -182,7 +182,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
 }
 
 -----------------------------------------------------------
@@ -190,7 +190,7 @@ RuntimeAgent.releaseObjectGroup(<number>,"test")
 
 request:
 {
-    seq : <number>
+    id : <number>
     domain : "Runtime"
     command : "releaseObjectGroup"
     arguments : {
@@ -201,7 +201,7 @@ request:
 
 response:
 {
-    seq : <number>
+    requestId : <number>
 }
 
 ===========================================================
index c6cf3e2..dec624e 100644 (file)
@@ -14,8 +14,9 @@ testProperty = true;
 
 function test()
 {
-    function callback(result)
+    function callback(error, result)
     {
+        var invalidObjectId = {id: -1, injectedScriptId: result.objectId.injectedScriptId};
         var testSuite = [
             ["RuntimeAgent", "evaluate", 'testObject', 'test', false],
             ["RuntimeAgent", "evaluateOn", result.objectId, 'this.assignedByEvaluateOn = "evaluateOn function works fine";'],
@@ -25,7 +26,7 @@ function test()
             ["RuntimeAgent", "releaseObject", result.objectId],
             ["RuntimeAgent", "releaseObjectGroup", result.objectId.injectedScriptId, 'test']];
 
-        InspectorTest.runProtocolTestSuite("RuntimeAgent", testSuite, ['seq', 'id', 'injectedScriptId']);
+        InspectorTest.runProtocolTestSuite("RuntimeAgent", testSuite, ['id', 'requestId', 'injectedScriptId']);
     }
 
     RuntimeAgent.evaluate('window.testObject', 'test', false, callback);
index 053d54f..eeb592d 100644 (file)
@@ -1,64 +1,64 @@
 Tests that InspectorBackendDispatcher is catching incorrect messages.
 
 {
-    seq : 0
-    errors : {
+    requestId : 0
+    protocolErrors : {
         0 : "Protocol Error: Invalid message format. Message should be in JSON format."
     }
 }
 {
-    seq : 0
-    errors : {
+    requestId : 0
+    protocolErrors : {
         0 : "Protocol Error: Invalid message format. 'command' property wasn't found."
     }
 }
 {
-    seq : 0
-    errors : {
+    requestId : 0
+    protocolErrors : {
         0 : "Protocol Error: Invalid message format. The type of 'command' property should be string."
     }
 }
 {
-    seq : 0
-    errors : {
-        0 : "Protocol Error: Invalid message format. 'seq' property was not found in the request."
+    requestId : 0
+    protocolErrors : {
+        0 : "Protocol Error: Invalid message format. 'id' property was not found in the request."
     }
 }
 {
-    seq : 0
-    errors : {
-        0 : "Protocol Error: Invalid message format. The type of 'seq' property should be number."
+    requestId : 0
+    protocolErrors : {
+        0 : "Protocol Error: Invalid message format. The type of 'id' property should be number."
     }
 }
 {
-    seq : 1
-    errors : {
+    requestId : 1
+    protocolErrors : {
         0 : "Protocol Error: Invalid command was received. 'test' wasn't found in domain DOM."
     }
 }
 {
-    seq : 2
-    errors : {
+    requestId : 2
+    protocolErrors : {
         0 : "Protocol Error: 'arguments' property with type 'object' was not found."
     }
 }
 {
-    seq : 3
-    errors : {
+    requestId : 3
+    protocolErrors : {
         0 : "Protocol Error: 'arguments' property with type 'object' was not found."
     }
 }
 {
-    seq : 4
-    errors : {
+    requestId : 4
+    protocolErrors : {
         0 : "Protocol Error: Argument 'frameId' with type 'Number' was not found."
         1 : "Protocol Error: Argument 'url' with type 'String' was not found."
         2 : "Protocol Error: Argument 'base64Encode' with type 'Boolean' was not found."
     }
 }
 {
-    seq : 5
-    errors : {
+    requestId : 5
+    protocolErrors : {
         0 : "Protocol Error: Argument 'frameId' with type 'Number' was not found."
         1 : "Protocol Error: Argument 'url' with type 'String' was not found."
         2 : "Protocol Error: Argument 'base64Encode' with type 'Boolean' was not found."
index 13ecac5..eedbed4 100644 (file)
@@ -10,12 +10,12 @@ function test()
         '{}',
         '{"command":1}',
         '{"domain":"Network","command":"resourceContent"}',
-        '{"seq":"not a number","domain":"Network","command":"resourceContent"}',
-        '{"seq":1,"domain":"DOM","command":"test"}',
-        '{"seq":2,"domain":"Network","command":"resourceContent"}',
-        '{"seq":3,"domain":"Network","command":"resourceContent","arguments":[]}',
-        '{"seq":4,"domain":"Network","command":"resourceContent","arguments":{}}',
-        '{"seq":5,"domain":"Network","command":"resourceContent","arguments":{"identifier":"not a number"}}',
+        '{"id":"not a number","domain":"Network","command":"resourceContent"}',
+        '{"id":1,"domain":"DOM","command":"test"}',
+        '{"id":2,"domain":"Network","command":"resourceContent"}',
+        '{"id":3,"domain":"Network","command":"resourceContent","arguments":[]}',
+        '{"id":4,"domain":"Network","command":"resourceContent","arguments":{}}',
+        '{"id":5,"domain":"Network","command":"resourceContent","arguments":{"identifier":"not a number"}}',
     ];
     var numberOfReports = 0;
 
index b85f729..c1427a3 100644 (file)
@@ -14,8 +14,13 @@ function test()
     var bodyId;
     function test_styles(node)
     {
-        function callback(styles)
+        function callback(error, styles)
         {
+            if (error) {
+                InspectorTest.addError("error: " + error);
+                return;
+            }
+
             InspectorTest.addResult("");
             InspectorTest.addResult("=== Computed style property count for body ===");
             var propCount = styles.computedStyle.cssProperties.length;
@@ -56,8 +61,12 @@ function test()
 
     function test_tableStyles()
     {
-        function callback(styles)
+        function callback(error, styles)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("=== Attribute styles for table ===");
             for (var attr in styles.styleAttributes) {
@@ -73,7 +82,7 @@ function test()
         }
         InspectorTest.nodeWithId("thetable", nodeCallback);
     }
-    
+
     function test_styleSheets()
     {
         var newStyleSheetText =
@@ -93,8 +102,12 @@ function test()
                 loadAndDumpStyleSheet.bind(null, styleSheet.styleSheetId, test_changeSelector));
         }
 
-        function styleSheetIdsLoaded(ids)
+        function styleSheetIdsLoaded(error, ids)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("=== All stylesheets ===");
             for (var i = 0; i < ids.length; ++i)
@@ -105,8 +118,12 @@ function test()
 
     function test_changeSelector(styleSheet)
     {
-        function didSetSelector(rule)
+        function didSetSelector(error, rule)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("=== After selector set ===");
             loadAndDumpStyleSheet(rule.ruleId.styleSheetId, test_setStyleText);
@@ -117,8 +134,12 @@ function test()
 
     function test_setStyleText(styleSheet)
     {
-        function didSetStyleText(style)
+        function didSetStyleText(error, style)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("=== After style text set ===");
             loadAndDumpStyleSheet(style.styleId.styleSheetId, test_addRule);
@@ -134,21 +155,33 @@ function test()
 
     function test_addRule()
     {
-        function didGetStyles(styles)
+        function didGetStyles(error, styles)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("=== Matched rules after rule added ===");
             dumpRulesArray(styles.matchedCSSRules);
             test_disableProperty();
         }
 
-        function didSetStyleText(style)
+        function didSetStyleText(error, style)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             CSSAgent.getStylesForNode(bodyId, didGetStyles);
         }
 
-        function ruleAdded(rule)
+        function ruleAdded(error, rule)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             CSSAgent.setPropertyText(rule.style.styleId, 0, "font-family: serif;", false, didSetStyleText);
         }
 
@@ -157,16 +190,24 @@ function test()
 
     function test_disableProperty()
     {
-        function didDisableProperty(style)
+        function didDisableProperty(error, style)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("=== After two properties disabled, one property added, one property removed ===");
             dumpRuleOrStyle(style);
             test_enableProperty(style.styleId);
         }
 
-        function stylesCallback(styles)
+        function stylesCallback(error, styles)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             // height : 100% ;
             // border: 1px solid;
             // border-width: 2px;
@@ -207,8 +248,12 @@ function test()
 
     function test_enableProperty(styleId)
     {
-        function didEnableProperty(style)
+        function didEnableProperty(error, style)
         {
+            if (error) {
+                InspectorTest.addResult("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("=== After property enabled ===");
             dumpRuleOrStyle(style);
@@ -248,10 +293,18 @@ function test()
     }
 
 
-    function loadAndDumpStyleSheet(styleSheetId, continuation)
+    function loadAndDumpStyleSheet(styleSheetId, continuation, error)
     {
-        function styleSheetLoaded(styleSheet)
+        if (error) {
+            InspectorTest.addRecord("error: " + error);
+            return;
+        }
+        function styleSheetLoaded(error, styleSheet)
         {
+            if (error) {
+                InspectorTest.addRecord("error: " + error);
+                return;
+            }
             InspectorTest.addResult("");
             InspectorTest.addResult("StyleSheet: '" + styleSheet.text + "'");
             for (var i = 0; i < styleSheet.rules.length; ++i)
index 84e309b..a2e77fc 100644 (file)
@@ -40,12 +40,16 @@ function test()
         CSSAgent.getStylesForNode(node.id, step2);
     }
 
-    function step2(styles)
+    function step2(error, styles)
     {
-        var matchedCSSRules = styles.matchedCSSRules;
-        for (var i = 0; i < matchedCSSRules.length; ++i)
-            dumpStyleData(matchedCSSRules[i]);
-        dumpStyleData(styles.inlineStyle);
+        if (error)
+            InspectorTest.addResult("error: " + error);
+        else {
+            var matchedCSSRules = styles.matchedCSSRules;
+            for (var i = 0; i < matchedCSSRules.length; ++i)
+                dumpStyleData(matchedCSSRules[i]);
+            dumpStyleData(styles.inlineStyle);
+        }
         InspectorTest.completeTest();
     }
 }
index 0249d83..be097a9 100644 (file)
@@ -18,7 +18,7 @@ InspectorTest.timelineNonDeterministicProps = {
 InspectorTest.startTimeline = function(callback)
 {
     InspectorTest._timelineRecords = [];
-    TimelineAgent.start(callback);
+    TimelineAgent.start(errorFilter.bind(this, callback));
     function addRecord(record)
     {
         InspectorTest._timelineRecords.push(record);
@@ -30,7 +30,7 @@ InspectorTest.startTimeline = function(callback)
 
 InspectorTest.stopTimeline = function(callback)
 {
-    TimelineAgent.stop(callback);
+    TimelineAgent.stop(errorFilter.bind(this, callback));
 };
 
 InspectorTest.performActionsAndPrint = function(actions, typeName)
index 1868fd1..da1cca7 100644 (file)
@@ -1,3 +1,104 @@
+2011-03-11  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: introduce error argument for all the callbacks on frontend.
+        https://bugs.webkit.org/show_bug.cgi?id=56100
+
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/front-end/AuditRules.js:
+        (WebInspector.AuditRules.evaluateInTargetWindow):
+        (WebInspector.AuditRules.UnusedCssRule.prototype.doRun.allStylesCallback):
+        (WebInspector.AuditRules.UnusedCssRule.prototype.doRun):
+        (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.getStyles):
+        (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun):
+        * inspector/front-end/CSSStyleModel.js:
+        (WebInspector.CSSStyleModel.prototype.getStylesAsync):
+        (WebInspector.CSSStyleModel.prototype.getComputedStyleAsync):
+        (WebInspector.CSSStyleModel.prototype.getInlineStyleAsync):
+        (WebInspector.CSSStyleModel.prototype.setRuleSelector):
+        (WebInspector.CSSStyleModel.prototype.setRuleSelector.callback):
+        (WebInspector.CSSStyleModel.prototype.addRule):
+        (WebInspector.CSSStyleModel.prototype.addRule.callback):
+        (WebInspector.CSSStyleModel.prototype._styleSheetChanged.callback):
+        (WebInspector.CSSStyleModel.prototype._styleSheetChanged):
+        (WebInspector.CSSStyleModel.prototype._onRevert):
+        (WebInspector.CSSStyleDeclaration.prototype.insertPropertyAt):
+        (WebInspector.CSSProperty.prototype.setText.callback):
+        (WebInspector.CSSProperty.prototype.setText):
+        (WebInspector.CSSProperty.prototype.setDisabled.callback):
+        (WebInspector.CSSProperty.prototype.setDisabled):
+        (WebInspector.CSSStyleSheet.createForId):
+        (WebInspector.CSSStyleSheet.prototype.setText):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.evalInInspectedWindow):
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMNode.prototype.setNodeName):
+        (WebInspector.DOMNode.prototype.setNodeValue):
+        (WebInspector.DOMNode.prototype.setAttribute):
+        (WebInspector.DOMNode.prototype.removeAttribute):
+        (WebInspector.DOMNode.prototype.childNodes.mycallback):
+        (WebInspector.DOMNode.prototype.childNodes):
+        (WebInspector.DOMNode.prototype.outerHTML):
+        (WebInspector.DOMNode.prototype.setOuterHTML):
+        (WebInspector.DOMNode.prototype.removeNode):
+        (WebInspector.DOMNode.prototype.copyNode):
+        (WebInspector.DOMAgent.prototype.pushNodeToFrontend):
+        (WebInspector.DOMAgent.prototype.pushNodeByPathToFrontend):
+        (WebInspector.DOMAgent.prototype._documentUpdated):
+        (WebInspector.ApplicationCacheDispatcher.getApplicationCachesAsync):
+        (WebInspector.Cookies.getCookiesAsync):
+        (WebInspector.EventListeners.getEventListenersForNodeAsync):
+        * inspector/front-end/DOMStorage.js:
+        (WebInspector.DOMStorage.prototype.getEntries):
+        (WebInspector.DOMStorage.prototype.setItem):
+        (WebInspector.DOMStorage.prototype.removeItem):
+        * inspector/front-end/Database.js:
+        (WebInspector.Database.prototype.getTableNames):
+        (WebInspector.Database.prototype.executeSql):
+        * inspector/front-end/DebuggerModel.js:
+        (WebInspector.DebuggerModel.prototype.setBreakpoint.didSetBreakpoint):
+        (WebInspector.DebuggerModel.prototype.setBreakpoint):
+        (WebInspector.DebuggerModel.prototype.setBreakpointBySourceId):
+        (WebInspector.DebuggerModel.prototype.editScriptSource):
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype._setSearchingForNode):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode.resolvedNode):
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
+        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback):
+        (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted):
+        ():
+        * inspector/front-end/ExtensionPanel.js:
+        (WebInspector.ExtensionWatchSidebarPane.prototype._onEvaluate):
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage):
+        * inspector/front-end/NetworkManager.js:
+        (WebInspector.NetworkManager.prototype.requestContent):
+        (WebInspector.NetworkManager.prototype._processCachedResources):
+        * inspector/front-end/ProfileView.js:
+        (WebInspector.CPUProfileView.profileCallback):
+        (WebInspector.CPUProfileView):
+        * inspector/front-end/ProfilesPanel.js:
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject.resolveNode):
+        (WebInspector.RemoteObject.prototype.getProperties.remoteObjectBinder):
+        (WebInspector.RemoteObject.prototype.getProperties):
+        (WebInspector.RemoteObject.prototype.setPropertyValue):
+        (WebInspector.RemoteObject.prototype.evaluate):
+        * inspector/front-end/Script.js:
+        (WebInspector.Script.prototype.requestSource.didGetScriptSource):
+        (WebInspector.Script.prototype.requestSource):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame.updatingCallbackWrapper):
+        (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame):
+        (WebInspector.ScriptsPanel.prototype._setPauseOnExceptions):
+        * inspector/front-end/inspector.js:
+        ():
+        (WebInspector.doLoadedDone.onPopulateScriptObjects):
+        (WebInspector.doLoadedDone.propertyNamesCallback):
+        (WebInspector.doLoadedDone):
+
 2011-03-11  Yury Semikhatsky  <yurys@chromium.org>
 
         Reviewed by Pavel Feldman.
index f4b0d56..6b9b4ab 100644 (file)
@@ -413,7 +413,6 @@ sub generateDocumentationEvent
 
     push(@lines, "<pre style='background: lightGrey; padding: 10px'>");
     push(@lines, "{");
-    push(@lines, "    seq: &lt;number&gt;,");
     push(@lines, "    type: \"event\",");
     push(@lines, "    domain: \"$domain\",");
     if (scalar(@argsFiltered)) {
@@ -478,6 +477,9 @@ sub generateBackendFunction
 
     # declare local variables for out arguments.
     push(@function, map("    " . typeTraits($_->type, "variable") . " " . $_->name . " = " . typeTraits($_->type, "defaultValue") . ";", @outArgs));
+    push(@function, "");
+    push(@function, "    ErrorString error;");
+    push(@function, "");
 
     my $indent = "";
     if (scalar(@inArgs)) {
@@ -493,12 +495,9 @@ sub generateBackendFunction
         $indent = "    ";
     }
 
-    push(@function, "$indent    ErrorString error;");
     my $args = join(", ", ("&error", map($_->name, @inArgs), map("&" . $_->name, @outArgs)));
     push(@function, "$indent    if (!protocolErrors->length())");
     push(@function, "$indent        $domainAccessor->$functionName($args);");
-    push(@function, "$indent    if (error.length())");
-    push(@function, "$indent        protocolErrors->pushString(error);");
     if (scalar(@inArgs)) {
         push(@function, "    } else {");
         push(@function, "        protocolErrors->pushString(\"Protocol Error: 'arguments' property with type 'object' was not found.\");");
@@ -508,12 +507,14 @@ sub generateBackendFunction
     push(@function, "    // use InspectorFrontend as a marker of WebInspector availability");
     push(@function, "    if (callId || protocolErrors->length()) {");
     push(@function, "        RefPtr<InspectorObject> responseMessage = InspectorObject::create();");
-    push(@function, "        responseMessage->setNumber(\"seq\", callId);");
+    push(@function, "        responseMessage->setNumber(\"requestId\", callId);");
     push(@function, "");
     push(@function, "        if (protocolErrors->length())");
-    push(@function, "            responseMessage->setArray(\"errors\", protocolErrors);");
+    push(@function, "            responseMessage->setArray(\"protocolErrors\", protocolErrors);");
     if (scalar(@outArgs)) {
         push(@function, "        else {");
+        push(@function, "            if (error.length())");
+        push(@function, "                responseMessage->setString(\"error\", error);");
         push(@function, "            RefPtr<InspectorObject> responseBody = InspectorObject::create();");
         push(@function, map("            responseBody->set" . typeTraits($_->type, "JSONType") . "(\"" . $_->name . "\", " . $_->name . ");", @outArgs));
         push(@function, "            responseMessage->setObject(\"body\", responseBody);");
@@ -547,7 +548,7 @@ sub generateDocumentationCommand
     my @inArgs = grep($_->direction eq "in" && !($_->name eq "callId") , @{$function->parameters});
     push(@lines, "<pre style='background: lightGrey; padding: 10px'>");
     push(@lines, "request: {");
-    push(@lines, "    seq: &lt;number&gt;,");
+    push(@lines, "    id: &lt;number&gt;,");
     push(@lines, "    type: \"request\",");
     push(@lines, "    domain: \"" . $interface->name . "\",");
     if (scalar(@inArgs)) {
@@ -567,7 +568,7 @@ sub generateDocumentationCommand
     my @outArgs = grep($_->direction eq "out", @{$function->parameters});    
     push(@lines, "");
     push(@lines, "response: {");
-    push(@lines, "    seq: &lt;number&gt;,");
+    push(@lines, "    requestId: &lt;number&gt;,");
     if (scalar(@outArgs)) {
         push(@lines, "    type: \"response\",");
         push(@lines, "    body: {");
@@ -593,10 +594,10 @@ sub generateBackendReportProtocolError
 void ${backendClassName}::reportProtocolError(const long callId, const String& errorText) const
 {
     RefPtr<InspectorObject> message = InspectorObject::create();
-    message->setNumber("seq", callId);
+    message->setNumber("requestId", callId);
     RefPtr<InspectorArray> errors = InspectorArray::create();
     errors->pushString(errorText);
-    message->setArray("errors", errors);
+    message->setArray("protocolErrors", errors);
     m_inspectorClient->sendMessageToFrontend(message->toJSONString());
 }
 EOF
@@ -696,14 +697,14 @@ $mapEntries
         return;
     }
 
-    RefPtr<InspectorValue> callIdValue = messageObject->get("seq");
+    RefPtr<InspectorValue> callIdValue = messageObject->get("id");
     if (!callIdValue) {
-        reportProtocolError(callId, "Protocol Error: Invalid message format. 'seq' property was not found in the request.");
+        reportProtocolError(callId, "Protocol Error: Invalid message format. 'id' property was not found in the request.");
         return;
     }
 
     if (!callIdValue->asNumber(&callId)) {
-        reportProtocolError(callId, "Protocol Error: Invalid message format. The type of 'seq' property should be number.");
+        reportProtocolError(callId, "Protocol Error: Invalid message format. The type of 'id' property should be number.");
         return;
     }
 
@@ -757,7 +758,7 @@ sub collectBackendJSStubFunctions
         my $name = $function->signature->name;
         my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . typeTraits($_->type, "JSType") . "\"", grep($_->direction eq "in", @{$function->parameters})));
         push(@backendJSStubs, "    this._registerDelegate('{" .
-            "\"seq\": 0, " .
+            "\"id\": 0, " .
             "\"domain\": \"$domain\", " .
             "\"command\": \"$name\", " .
             "\"arguments\": {$argumentNames}" .
@@ -823,7 +824,7 @@ InspectorBackendStub.prototype = {
             }
             callback = args[0];
         }
-        request.seq = this._wrap(callback || function() {});
+        request.id = this._wrap(callback || function() {});
 
         if (window.dumpInspectorProtocolMessages)
             console.log("frontend: " + JSON.stringify(request));
@@ -851,14 +852,19 @@ InspectorBackendStub.prototype = {
             for (var key in messageObject.body)
                 arguments.push(messageObject.body[key]);
 
-        if ("seq" in messageObject) { // just a response for some request
-            if (!messageObject.errors)
-                this._callbacks[messageObject.seq].apply(null, arguments);
-            else
+        if ("requestId" in messageObject) { // just a response for some request
+            if (messageObject.protocolErrors)
                 this.reportProtocolError(messageObject);
 
-            --this._pendingResponsesCount;
-            delete this._callbacks[messageObject.seq];
+            var callback = this._callbacks[messageObject.requestId];
+            if (callback) {
+                if (!messageObject.protocolErrors) {
+                    arguments.unshift(messageObject.error);
+                    callback.apply(null, arguments);
+                }
+                --this._pendingResponsesCount;
+                delete this._callbacks[messageObject.requestId];
+            }
 
             if (this._scripts && !this._pendingResponsesCount)
                 this.runAfterPendingDispatches();
@@ -876,15 +882,16 @@ InspectorBackendStub.prototype = {
                 console.error("Protocol Error: Attempted to dispatch an unimplemented method '" + messageObject.domain + "." + messageObject.event + "'");
                 return;
             }
+
             dispatcher[messageObject.event].apply(dispatcher, arguments);
         }
     },
 
     reportProtocolError: function(messageObject)
     {
-        console.error("Protocol Error: InspectorBackend request with seq = " + messageObject.seq + " failed.");
-        for (var i = 0; i < messageObject.errors.length; ++i)
-            console.error("    " + messageObject.errors[i]);
+        console.error("Protocol Error: InspectorBackend request with id = " + messageObject.requestId + " failed.");
+        for (var i = 0; i < messageObject.protocolErrors.length; ++i)
+            console.error("    " + messageObject.protocolErrors[i]);
     },
 
     runAfterPendingDispatches: function(script)
index 803e9e0..b614256 100644 (file)
@@ -65,9 +65,9 @@ WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, nee
 
 WebInspector.AuditRules.evaluateInTargetWindow = function(func, args, callback)
 {
-    function mycallback(result)
+    function mycallback(error, result)
     {
-        if (result)
+        if (!error && result)
             callback(JSON.parse(result.description));
         else
             callback(null);
@@ -385,9 +385,9 @@ WebInspector.AuditRules.UnusedCssRule.prototype = {
                 continuation(styleSheets);
         }
 
-        function allStylesCallback(styleSheetIds)
+        function allStylesCallback(error, styleSheetIds)
         {
-            if (!styleSheetIds || !styleSheetIds.length)
+            if (error || !styleSheetIds || !styleSheetIds.length)
                 return evalCallback([]);
             var styleSheets = [];
             for (var i = 0; i < styleSheetIds.length; ++i)
@@ -717,8 +717,10 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
                 doneCallback();
         }
 
-        function getStyles(nodeIds)
+        function getStyles(error, nodeIds)
         {
+            if (error)
+                return;
             for (var i = 0; i < nodeIds.length; ++i)
                 WebInspector.cssModel.getStylesAsync(nodeIds[i], imageStylesReady.bind(this, nodeIds[i], i === nodeIds.length - 1));
         }
index 0e7cd49..c66dfe2 100644 (file)
@@ -43,9 +43,9 @@ WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray)
 WebInspector.CSSStyleModel.prototype = {
     getStylesAsync: function(nodeId, userCallback)
     {
-        function callback(userCallback, payload)
+        function callback(userCallback, error, payload)
         {
-            if (!payload) {
+            if (error || !payload) {
                 if (userCallback)
                     userCallback(null);
                 return;
@@ -88,9 +88,9 @@ WebInspector.CSSStyleModel.prototype = {
 
     getComputedStyleAsync: function(nodeId, userCallback)
     {
-        function callback(userCallback, stylePayload)
+        function callback(userCallback, error, stylePayload)
         {
-            if (!stylePayload)
+            if (error || !stylePayload)
                 userCallback(null);
             else
                 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
@@ -101,9 +101,9 @@ WebInspector.CSSStyleModel.prototype = {
 
     getInlineStyleAsync: function(nodeId, userCallback)
     {
-        function callback(userCallback, stylePayload)
+        function callback(userCallback, error, stylePayload)
         {
-            if (!stylePayload)
+            if (error || !stylePayload)
                 userCallback(null);
             else
                 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
@@ -114,17 +114,20 @@ WebInspector.CSSStyleModel.prototype = {
 
     setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, failureCallback)
     {
-        function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
+        function checkAffectsCallback(nodeId, successCallback, rulePayload, error, selectedNodeIds)
         {
+            if (error)
+                return;
             var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
             var rule = WebInspector.CSSRule.parsePayload(rulePayload);
             successCallback(rule, doesAffectSelectedNode);
             this._styleSheetChanged(rule.id.styleSheetId, true);
         }
 
-        function callback(nodeId, successCallback, failureCallback, newSelector, rulePayload)
+        function callback(nodeId, successCallback, failureCallback, error, newSelector, rulePayload)
         {
-            if (!rulePayload)
+            // FIXME: looks lire rulePayload always null.
+            if (error || !rulePayload)
                 failureCallback();
             else
                 DOMAgent.querySelectorAll(nodeId, newSelector, true, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
@@ -135,7 +138,7 @@ WebInspector.CSSStyleModel.prototype = {
 
     addRule: function(nodeId, selector, successCallback, failureCallback)
     {
-        function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
+        function checkAffectsCallback(nodeId, successCallback, rulePayload, error, selectedNodeIds)
         {
             var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
             var rule = WebInspector.CSSRule.parsePayload(rulePayload);
@@ -143,9 +146,9 @@ WebInspector.CSSStyleModel.prototype = {
             this._styleSheetChanged(rule.id.styleSheetId, true);
         }
 
-        function callback(successCallback, failureCallback, selector, rulePayload)
+        function callback(successCallback, failureCallback, selector, error, rulePayload)
         {
-            if (!rulePayload) {
+            if (error || !rulePayload) {
                 // Invalid syntax for a selector
                 failureCallback();
             } else
@@ -160,8 +163,10 @@ WebInspector.CSSStyleModel.prototype = {
         if (!majorChange || !styleSheetId)
             return;
 
-        function callback(href, content)
+        function callback(error, href, content)
         {
+            if (error)
+                return;
             var resource = WebInspector.resourceForURL(href);
             if (resource && resource.type === WebInspector.Resource.Type.Stylesheet)
                 resource.setContent(content, this._onRevert.bind(this, styleSheetId));
@@ -171,8 +176,10 @@ WebInspector.CSSStyleModel.prototype = {
 
     _onRevert: function(styleSheetId, contentToRevertTo)
     {
-        function callback(success)
+        function callback(error, success)
         {
+            if (error)
+                return;
             this._styleSheetChanged(styleSheetId, true);
             this.dispatchEventToListeners("stylesheet changed");
         }
@@ -335,12 +342,12 @@ WebInspector.CSSStyleDeclaration.prototype = {
 
     insertPropertyAt: function(index, name, value, userCallback)
     {
-        function callback(userCallback, payload)
+        function callback(userCallback, error, payload)
         {
             if (!userCallback)
                 return;
 
-            if (!payload)
+            if (error || !payload)
                 userCallback(null);
             else {
                 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
@@ -464,9 +471,9 @@ WebInspector.CSSProperty.prototype = {
                 userCallback(style);
         }
 
-        function callback(stylePayload)
+        function callback(error, stylePayload)
         {
-            if (stylePayload) {
+            if (!error && stylePayload) {
                 this.text = propertyText;
                 var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
                 var newProperty = style.allProperties[this.index];
@@ -504,11 +511,11 @@ WebInspector.CSSProperty.prototype = {
         if (disabled === this.disabled && userCallback)
             userCallback(this.ownerStyle);
 
-        function callback(stylePayload)
+        function callback(error, stylePayload)
         {
             if (!userCallback)
                 return;
-            if (!stylePayload)
+            if (error || !stylePayload)
                 userCallback(null);
             else {
                 var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
@@ -541,9 +548,9 @@ WebInspector.CSSStyleSheet = function(payload)
 
 WebInspector.CSSStyleSheet.createForId = function(styleSheetId, userCallback)
 {
-    function callback(styleSheetPayload)
+    function callback(error, styleSheetPayload)
     {
-        if (!styleSheetPayload)
+        if (error || !styleSheetPayload)
             userCallback(null);
         else
             userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
@@ -559,9 +566,9 @@ WebInspector.CSSStyleSheet.prototype = {
 
     setText: function(newText, userCallback)
     {
-        function callback(styleSheetPayload)
+        function callback(error, styleSheetPayload)
         {
-            if (!styleSheetPayload)
+            if (error || !styleSheetPayload)
                 userCallback(null);
             else {
                 userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
index f59d87f..b4f046c 100644 (file)
@@ -531,9 +531,10 @@ WebInspector.ConsoleView.prototype = {
             expression = "this";
         }
 
-        function evalCallback(result)
+        function evalCallback(error, result)
         {
-            callback(WebInspector.RemoteObject.fromPayload(result));
+            if (!error)
+                callback(WebInspector.RemoteObject.fromPayload(result));
         }
         RuntimeAgent.evaluate(expression, objectGroup, includeCommandLineAPI, evalCallback);
     },
index 8dc2378..50021cc 100644 (file)
@@ -104,7 +104,7 @@ WebInspector.DOMNode.prototype = {
 
     setNodeName: function(name, callback)
     {
-        DOMAgent.setNodeName(this.id, name, callback);
+        DOMAgent.setNodeName(this.id, name, errorFilter.bind(null, callback));
     },
 
     localName: function()
@@ -119,7 +119,7 @@ WebInspector.DOMNode.prototype = {
 
     setNodeValue: function(value, callback)
     {
-        DOMAgent.setNodeValue(this.id, value, callback);
+        DOMAgent.setNodeValue(this.id, value, errorFilter.bind(null, callback));
     },
 
     getAttribute: function(name)
@@ -130,9 +130,9 @@ WebInspector.DOMNode.prototype = {
 
     setAttribute: function(name, value, callback)
     {
-        function mycallback(success)
+        function mycallback(error, success)
         {
-            if (!success)
+            if (error || !success)
                 return;
 
             var attr = this._attributesMap[name];
@@ -154,9 +154,9 @@ WebInspector.DOMNode.prototype = {
 
     removeAttribute: function(name, callback)
     {
-        function mycallback(success)
+        function mycallback(error, success)
         {
-            if (!success)
+            if (error || !success)
                 return;
 
             delete this._attributesMap[name];
@@ -180,8 +180,8 @@ WebInspector.DOMNode.prototype = {
             return;
         }
 
-        function mycallback() {
-            if (callback)
+        function mycallback(error) {
+            if (!error && callback)
                 callback(this.children);
         }
         DOMAgent.childNodes(this.id, mycallback.bind(this));
@@ -189,22 +189,22 @@ WebInspector.DOMNode.prototype = {
 
     outerHTML: function(callback)
     {
-        DOMAgent.outerHTML(this.id, callback);
+        DOMAgent.outerHTML(this.id, errorFilter.bind(null, callback));
     },
 
     setOuterHTML: function(html, callback)
     {
-        DOMAgent.setOuterHTML(this.id, html, callback);
+        DOMAgent.setOuterHTML(this.id, html, errorFilter.bind(null, callback));
     },
 
     removeNode: function(callback)
     {
-        DOMAgent.removeNode(this.id);
+        DOMAgent.removeNode(this.id, errorFilter.bind(null, callback));
     },
 
-    copyNode: function()
+    copyNode: function(callback)
     {
-        DOMAgent.copyNode(this.id);
+        DOMAgent.copyNode(this.id, errorFilter.bind(null, callback));
     },
 
     path: function()
@@ -357,7 +357,7 @@ WebInspector.DOMAgent.prototype = {
         function mycallback()
         {
             if (this._document)
-                DOMAgent.pushNodeToFrontend(objectId, callback);
+                DOMAgent.pushNodeToFrontend(objectId, errorFilter.bind(null, callback));
             else {
                 if (callback)
                     callback(0);
@@ -371,7 +371,7 @@ WebInspector.DOMAgent.prototype = {
         function mycallback()
         {
             if (this._document)
-                DOMAgent.pushNodeByPathToFrontend(path, callback);
+                DOMAgent.pushNodeByPathToFrontend(path, errorFilter.bind(null, callback));
             else {
                 if (callback)
                     callback(0);
@@ -403,8 +403,11 @@ WebInspector.DOMAgent.prototype = {
 
     _documentUpdated: function(callback)
     {
-        function mycallback(root)
+        function mycallback(error, root)
         {
+            if (error)
+                return;
+
             this._setDocument(root);
             if (callback)
                 callback(this._document);
@@ -553,10 +556,10 @@ WebInspector.ApplicationCacheDispatcher = function()
 
 WebInspector.ApplicationCacheDispatcher.getApplicationCachesAsync = function(callback)
 {
-    function mycallback(applicationCaches)
+    function mycallback(error, applicationCaches)
     {
         // FIXME: Currently, this list only returns a single application cache.
-        if (applicationCaches)
+        if (!error && applicationCaches)
             callback(applicationCaches);
     }
 
@@ -581,8 +584,10 @@ WebInspector.Cookies = {}
 
 WebInspector.Cookies.getCookiesAsync = function(callback)
 {
-    function mycallback(cookies, cookiesString)
+    function mycallback(error, cookies, cookiesString)
     {
+        if (error)
+            return;
         if (cookiesString)
             callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false);
         else
@@ -634,5 +639,5 @@ WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callb
 {
     if (!node)
         return;
-    DOMAgent.getEventListenersForNode(node.id, callback);
+    DOMAgent.getEventListenersForNode(node.id, errorFilter.bind(this, callback));
 }
index ea24921..8579ba5 100644 (file)
@@ -51,17 +51,17 @@ WebInspector.DOMStorage.prototype = {
 
     getEntries: function(callback)
     {
-        DOMStorageAgent.getDOMStorageEntries(this._id, callback);
+        DOMStorageAgent.getDOMStorageEntries(this._id, errorFilter.bind(null, callback));
     },
     
     setItem: function(key, value, callback)
     {
-        DOMStorageAgent.setDOMStorageItem(this._id, key, value, callback);
+        DOMStorageAgent.setDOMStorageItem(this._id, key, value, errorFilter.bind(null, callback));
     },
     
     removeItem: function(key, callback)
     {
-        DOMStorageAgent.removeDOMStorageItem(this._id, key, callback);
+        DOMStorageAgent.removeDOMStorageItem(this._id, key, errorFilter.bind(null, callback));
     }
 }
 
index e4bafea..685c288 100644 (file)
@@ -77,17 +77,22 @@ WebInspector.Database.prototype = {
 
     getTableNames: function(callback)
     {
-        function sortingCallback(names)
+        function sortingCallback(error, names)
         {
-            callback(names.sort());
+            if (!error)
+                callback(names.sort());
         }
         DatabaseAgent.getDatabaseTableNames(this._id, sortingCallback);
     },
     
     executeSql: function(query, onSuccess, onError)
     {
-        function callback(success, transactionId)
+        function callback(error, success, transactionId)
         {
+            if (error) {
+                onError(error);
+                return;
+            }
             if (!success) {
                 onError(WebInspector.UIString("Database not found."));
                 return;
index bfdfa56..a097e00 100644 (file)
@@ -87,9 +87,9 @@ WebInspector.DebuggerModel.prototype = {
         }
         columnNumber = Math.max(columnNumber, minColumnNumber);
 
-        function didSetBreakpoint(breakpointsPushedToBackend, breakpointId, locations)
+        function didSetBreakpoint(breakpointsPushedToBackend, error, breakpointId, locations)
         {
-            if (!breakpointId) {
+            if (error || !breakpointId) {
                 WebInspector.log("failed");
                 return;
             }
@@ -106,9 +106,9 @@ WebInspector.DebuggerModel.prototype = {
 
     setBreakpointBySourceId: function(sourceID, lineNumber, columnNumber, condition, enabled)
     {
-        function didSetBreakpoint(breakpointId, actualLineNumber, actualColumnNumber)
+        function didSetBreakpoint(error, breakpointId, actualLineNumber, actualColumnNumber)
         {
-            if (!breakpointId)
+            if (error || !breakpointId)
                 return;
             var breakpoint = new WebInspector.Breakpoint(breakpointId, "", sourceID, lineNumber, columnNumber, condition, enabled);
             breakpoint.addLocation(sourceID, actualLineNumber, actualColumnNumber);
@@ -222,8 +222,10 @@ WebInspector.DebuggerModel.prototype = {
 
     editScriptSource: function(sourceID, scriptSource)
     {
-        function didEditScriptSource(success, newBodyOrErrorMessage, callFrames)
+        function didEditScriptSource(error, success, newBodyOrErrorMessage, callFrames)
         {
+            if (error)
+                return;
             if (success) {
                 if (callFrames && callFrames.length)
                     this._callFrames = callFrames;
index 45870fa..0c884a9 100644 (file)
@@ -1104,9 +1104,10 @@ WebInspector.ElementsPanel.prototype = {
         this._nodeSearchButton.toggled = false;
     },
 
-    _setSearchingForNode: function(enabled)
+    _setSearchingForNode: function(error, enabled)
     {
-        this._nodeSearchButton.toggled = enabled;
+        if (!error)
+            this._nodeSearchButton.toggled = enabled;
     },
 
     setSearchingForNode: function(enabled)
index 630c374..6c9cd70 100644 (file)
@@ -426,9 +426,9 @@ WebInspector.ElementsTreeElement.prototype = {
             }
         }
 
-        function resolvedNode(objectPayload)
+        function resolvedNode(error, objectPayload)
         {
-            if (!objectPayload)
+            if (error || !objectPayload)
                 return;
 
             var object = WebInspector.RemoteObject.fromPayload(objectPayload);
@@ -969,10 +969,12 @@ WebInspector.ElementsTreeElement.prototype = {
         return true;
     },
 
-    _startEditingAsHTML: function(commitCallback, initialValue)
+    _startEditingAsHTML: function(commitCallback, error, initialValue)
     {
+        if (error)
+            return;
         if (this._htmlEditElement && WebInspector.isBeingEdited(this._htmlEditElement))
-            return true;
+            return;
 
         this._htmlEditElement = document.createElement("div");
         this._htmlEditElement.className = "source-code elements-tree-editor";
@@ -1164,9 +1166,9 @@ WebInspector.ElementsTreeElement.prototype = {
         var treeOutline = this.treeOutline;
         var wasExpanded = this.expanded;
 
-        function changeTagNameCallback(nodeId)
+        function changeTagNameCallback(error, nodeId)
         {
-            if (!nodeId) {
+            if (error || !nodeId) {
                 cancel();
                 return;
             }
@@ -1422,7 +1424,7 @@ WebInspector.ElementsTreeElement.prototype = {
         {
             // -1 is an error code, which means removing the node from the DOM failed,
             // so we shouldn't remove it from the tree.
-            if (removedNodeId === -1)
+            if (error || removedNodeId === -1)
                 return;
 
             parentElement.removeChild(self);
@@ -1438,9 +1440,9 @@ WebInspector.ElementsTreeElement.prototype = {
         var node = this.representedObject;
         var wasExpanded = this.expanded;
 
-        function selectNode(nodeId)
+        function selectNode(error, nodeId)
         {
-            if (!nodeId)
+            if (error || !nodeId)
                 return;
 
             // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
index 142b8c1..4249b2c 100644 (file)
@@ -98,9 +98,10 @@ WebInspector.ExtensionWatchSidebarPane.prototype = {
         RuntimeAgent.evaluate(expression, "extension-watch", false, this._onEvaluate.bind(this, title));
     },
 
-    _onEvaluate: function(title, result)
+    _onEvaluate: function(title, error, result)
     {
-        this._setObject(WebInspector.RemoteObject.fromPayload(result), title);
+        if (!error)
+            this._setObject(WebInspector.RemoteObject.fromPayload(result), title);
     },
 
     _setObject: function(object, title)
index f9af7dc..64403a4 100644 (file)
@@ -269,8 +269,10 @@ WebInspector.ExtensionServer.prototype = {
 
     _onEvaluateOnInspectedPage: function(message, port)
     {
-        function callback(resultPayload)
+        function callback(error, resultPayload)
         {
+            if (error)
+                return;
             var resultObject = WebInspector.RemoteObject.fromPayload(resultPayload);
             var result = {};
             if (resultObject.isError())
index 246b53c..8492b9e 100644 (file)
@@ -53,15 +53,17 @@ WebInspector.NetworkManager.prototype = {
 
     requestContent: function(resource, base64Encode, callback)
     {
-        function callbackWrapper(success, content)
+        function callbackWrapper(error, success, content)
         {
-            callback(success ? content : null);
+            callback((!error && success) ? content : null);
         }
         NetworkAgent.resourceContent(resource.loader.frameId, resource.url, base64Encode, callbackWrapper);
     },
 
-    _processCachedResources: function(mainFramePayload)
+    _processCachedResources: function(error, mainFramePayload)
     {
+        if (error)
+            return;
         var mainResource = this._dispatcher._addFramesRecursively(mainFramePayload);
         WebInspector.mainResource = mainResource;
         mainResource.isMainResource = true;
index 335bf03..9f4d822 100644 (file)
@@ -81,8 +81,10 @@ WebInspector.CPUProfileView = function(profile)
     this.profile = profile;
 
     var self = this;
-    function profileCallback(profile)
+    function profileCallback(error, profile)
     {
+        if (error)
+            return;
         self.profile.head = profile.head;
         self._assignParentsInProfile();
       
index e5fb49e..cb8e138 100644 (file)
@@ -626,7 +626,9 @@ WebInspector.ProfilesPanel.prototype = {
         if (!this._profilerEnabled || this._profilesWereRequested)
             return;
 
-        function populateCallback(profileHeaders) {
+        function populateCallback(error, profileHeaders) {
+            if (error)
+                return;
             profileHeaders.sort(function(a, b) { return a.uid - b.uid; });
             var profileHeadersLength = profileHeaders.length;
             for (var i = 0; i < profileHeadersLength; ++i)
index a43bb71..4e933c9 100644 (file)
@@ -48,8 +48,10 @@ WebInspector.RemoteObject.fromLocalObject = function(value)
 
 WebInspector.RemoteObject.resolveNode = function(node, callback)
 {
-    function mycallback(object)
+    function mycallback(error, object)
     {
+        if (error)
+            return;
         callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
     }
     DOMAgent.resolveNode(node.id, "dom-selection", mycallback);
@@ -112,8 +114,10 @@ WebInspector.RemoteObject.prototype = {
             callback([]);
             return;
         }
-        function remoteObjectBinder(properties)
+        function remoteObjectBinder(error, properties)
         {
+            if (error)
+                return;
             for (var i = 0; properties && i < properties.length; ++i)
                 properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value);
             callback(properties);
@@ -127,7 +131,7 @@ WebInspector.RemoteObject.prototype = {
             callback(false);
             return;
         }
-        RuntimeAgent.setPropertyValue(this._objectId, name, value, callback);
+        RuntimeAgent.setPropertyValue(this._objectId, name, value, errorFilter.bind(this, callback));
     },
 
     pushNodeToFrontend: function(callback)
@@ -140,7 +144,7 @@ WebInspector.RemoteObject.prototype = {
 
     evaluate: function(expression, callback)
     {
-        RuntimeAgent.evaluateOn(this._objectId, expression, callback);
+        RuntimeAgent.evaluateOn(this._objectId, expression, errorFilter.bind(this, callback));
     }
 }
 
index 3f27485..805e191 100644 (file)
@@ -115,8 +115,10 @@ WebInspector.Script.prototype = {
             return;
         }
 
-        function didGetScriptSource(source)
+        function didGetScriptSource(error, source)
         {
+            if (error)
+                return;
             this._source = source;
             callback(this._source);
         }
index 9713640..c793474 100644 (file)
@@ -413,9 +413,9 @@ WebInspector.ScriptsPanel.prototype = {
         if (!this._paused || !selectedCallFrame)
             return;
 
-        function updatingCallbackWrapper(result)
+        function updatingCallbackWrapper(error, result)
         {
-            if (result)
+            if (!error && result)
                 callback(WebInspector.RemoteObject.fromPayload(result));
         }
         DebuggerAgent.evaluateOnCallFrame(selectedCallFrame.id, code, objectGroup, includeCommandLineAPI, updatingCallbackWrapper.bind(this));
@@ -731,8 +731,10 @@ WebInspector.ScriptsPanel.prototype = {
 
     _setPauseOnExceptions: function(pauseOnExceptionsState)
     {
-        function callback(pauseOnExceptionsState)
+        function callback(error, pauseOnExceptionsState)
         {
+            if (error)
+                return;
             if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions)
                 this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
             else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions)
index b4c3fda..ea9df5e 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: {},
@@ -522,9 +531,9 @@ WebInspector.doLoadedDone = function()
 
     this.extensionServer.initExtensions();
 
-    function onPopulateScriptObjects()
+    function onPopulateScriptObjects(error)
     {
-        if (!WebInspector.currentPanel)
+        if (!error && !WebInspector.currentPanel)
             WebInspector.showPanel(WebInspector.settings.lastActivePanel);
     }
     InspectorAgent.populateScriptObjects(onPopulateScriptObjects);
@@ -538,9 +547,10 @@ WebInspector.doLoadedDone = function()
 
     ConsoleAgent.setConsoleMessagesEnabled(true);
 
-    function propertyNamesCallback(names)
+    function propertyNamesCallback(error, names)
     {
-        WebInspector.cssNameCompletions = new WebInspector.CSSCompletions(names);
+        if (!error)
+            WebInspector.cssNameCompletions = new WebInspector.CSSCompletions(names);
     }
     // As a DOMAgent method, this needs to happen after the frontend has loaded and the agent is available.
     CSSAgent.getSupportedCSSProperties(propertyNamesCallback);