[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

loislo at chromium.org loislo at chromium.org
Wed Dec 22 17:55:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 519cbcc56c065fa5e6517dcc8f9ca7ead458f184
Author: loislo at chromium.org <loislo at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 2 18:22:16 2010 +0000

    2010-12-01  Ilya Tikhonovsky  <loislo at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: Inspector protocol cleanup task.
    
            The patch has just small renames and adjustments for the protocol things.
            'handler' keyword in idl file was replaced with 'domain'.
            'domain' property was assigned for the each backend to frontend messages.
            At the next step WebInspector wrapper functions will be removed and 'agents' will be called directly.
    
            https://bugs.webkit.org/show_bug.cgi?id=50337
    
            * inspector/CodeGeneratorInspector.pm:
            * inspector/Inspector.idl:
            * inspector/front-end/inspector.js:
            (WebInspector_syncDispatch):
    
    2010-12-01  Ilya Tikhonovsky  <loislo at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: Inspector protocol cleanup task.
    
            The patch has just small renames and adjustments for the protocol things.
            'handler' keyword in idl file was replaced with 'domain'.
            'domain' property was assigned for the each backend to frontend messages.
            At the next step WebInspector wrapper functions will be removed and 'agents' will be called directly.
    
            https://bugs.webkit.org/show_bug.cgi?id=50337
    
            * inspector/report-API-errors-expected.txt:
            * inspector/report-API-errors.html:
            * inspector/report-protocol-errors-expected.txt:
    
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73152 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index de76139..3bdb7a8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-01  Ilya Tikhonovsky  <loislo at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: Inspector protocol cleanup task.
+
+        The patch has just small renames and adjustments for the protocol things.
+        'handler' keyword in idl file was replaced with 'domain'.
+        'domain' property was assigned for the each backend to frontend messages.
+        At the next step WebInspector wrapper functions will be removed and 'agents' will be called directly.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50337
+
+        * inspector/report-API-errors-expected.txt:
+        * inspector/report-API-errors.html:
+        * inspector/report-protocol-errors-expected.txt:
+
 2010-12-02  Tony Chang  <tony at chromium.org>
 
         Unreviewed, add back fast/overflow/hit-test-overflow-controls.html
diff --git a/LayoutTests/inspector/report-API-errors-expected.txt b/LayoutTests/inspector/report-API-errors-expected.txt
index abab55e..263f80e 100644
--- a/LayoutTests/inspector/report-API-errors-expected.txt
+++ b/LayoutTests/inspector/report-API-errors-expected.txt
@@ -3,5 +3,6 @@ Tests that InspectorBackendStub is catching incorrect arguments.
 Protocol Error: Invalid type of argument 'enable' for 'InspectorBackend.setMonitoringXHREnabled' call. It should be 'boolean' but it is 'number'.
 Protocol Error: Invalid number of arguments for 'InspectorBackend.setMonitoringXHREnabled' call. It should have the next arguments '{"enable":"boolean"}'.
 Protocol Error: Optional callback argument for 'InspectorBackend.setMonitoringXHREnabled' call should be a function but its type is 'string'.
-Protocol Error: Attempted to dispatch an unimplemented WebInspector method 'something-strange'
+Protocol Error: the message is for non-existing domain 'wrongDomain'
+Protocol Error: Attempted to dispatch an unimplemented method 'Inspector.something-strange'
 
diff --git a/LayoutTests/inspector/report-API-errors.html b/LayoutTests/inspector/report-API-errors.html
index a2bc280..45eeca8 100644
--- a/LayoutTests/inspector/report-API-errors.html
+++ b/LayoutTests/inspector/report-API-errors.html
@@ -16,7 +16,8 @@ function test()
     InspectorBackend.setMonitoringXHREnabled(true, "not a function");
     InspectorBackend.setMonitoringXHREnabled(true, undefined);
     InspectorBackend.setMonitoringXHREnabled(false, undefined);
-    WebInspector_syncDispatch('{"type": "event", "domain": "dom", "event": "something-strange", "data": {}}');
+    InspectorBackend.dispatch('{"type": "event", "domain": "wrongDomain", "event": "something-strange", "data": {}}');
+    InspectorBackend.dispatch('{"type": "event", "domain": "Inspector", "event": "something-strange", "data": {}}');
 
     InspectorTest.completeTest();
 }
diff --git a/LayoutTests/inspector/report-protocol-errors-expected.txt b/LayoutTests/inspector/report-protocol-errors-expected.txt
index f10273b..2221c84 100644
--- a/LayoutTests/inspector/report-protocol-errors-expected.txt
+++ b/LayoutTests/inspector/report-protocol-errors-expected.txt
@@ -44,6 +44,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 2
+    domain : "Resources"
     success : false
     errors : {
         0 : "Protocol Error: 'arguments' property with type 'object' was not found."
@@ -51,6 +52,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 3
+    domain : "Resources"
     success : false
     errors : {
         0 : "Protocol Error: 'arguments' property with type 'object' was not found."
@@ -58,6 +60,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 4
+    domain : "Resources"
     success : false
     errors : {
         0 : "Protocol Error: Argument 'frameId' with type 'Number' was not found."
@@ -67,6 +70,7 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 5
+    domain : "Resources"
     success : false
     errors : {
         0 : "Protocol Error: Argument 'frameId' with type 'Number' was not found."
@@ -76,18 +80,20 @@ Tests that InspectorBackendDispatcher is catching incorrect messages.
 }
 {
     seq : 6
+    domain : "Debugger"
     success : false
     errors : {
-        0 : "Protocol Error: Debug handler is not available."
+        0 : "Protocol Error: Debugger handler is not available."
         1 : "Protocol Error: Argument 'sourceID' with type 'String' was not found."
         2 : "Protocol Error: Argument 'lineNumber' with type 'Number' was not found."
     }
 }
 {
     seq : 7
+    domain : "Debugger"
     success : false
     errors : {
-        0 : "Protocol Error: Debug handler is not available."
+        0 : "Protocol Error: Debugger handler is not available."
     }
 }
 
diff --git a/LayoutTests/inspector/report-protocol-errors.html b/LayoutTests/inspector/report-protocol-errors.html
index 4730ae4..d48961d 100644
--- a/LayoutTests/inspector/report-protocol-errors.html
+++ b/LayoutTests/inspector/report-protocol-errors.html
@@ -22,7 +22,7 @@ function test()
     ];
     var numberOfReports = 0;
 
-    WebInspector.reportProtocolError = function(message)
+    InspectorBackend.reportProtocolError = function(message)
     {
         if (numberOfReports < messages.length)
             InspectorTest.addObject(message);
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 694113d..95c0852 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-12-01  Ilya Tikhonovsky  <loislo at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: Inspector protocol cleanup task.
+
+        The patch has just small renames and adjustments for the protocol things.
+        'handler' keyword in idl file was replaced with 'domain'.
+        'domain' property was assigned for the each backend to frontend messages.
+        At the next step WebInspector wrapper functions will be removed and 'agents' will be called directly.
+
+        https://bugs.webkit.org/show_bug.cgi?id=50337
+
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/Inspector.idl:
+        * inspector/front-end/inspector.js:
+        (WebInspector_syncDispatch):
+
 2010-12-01  Andrey Kosyakov  <caseq at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/inspector/CodeGeneratorInspector.pm b/WebCore/inspector/CodeGeneratorInspector.pm
index 177ca3b..6d2e3c4 100644
--- a/WebCore/inspector/CodeGeneratorInspector.pm
+++ b/WebCore/inspector/CodeGeneratorInspector.pm
@@ -19,16 +19,16 @@ $typeTransform{"Backend"} = {
     "header" => "InspectorBackend.h",
     "domainAccessor" => "m_inspectorController->inspectorBackend()",
 };
-$typeTransform{"Controller"} = {
+$typeTransform{"Inspector"} = {
     "forwardHeader" => "InspectorController.h",
     "domainAccessor" => "m_inspectorController",
 };
-$typeTransform{"Debug"} = {
+$typeTransform{"Debugger"} = {
     "forward" => "InspectorDebuggerAgent",
     "header" => "InspectorDebuggerAgent.h",
     "domainAccessor" => "m_inspectorController->debuggerAgent()",
 };
-$typeTransform{"Resource"} = {
+$typeTransform{"Resources"} = {
     "forward" => "InspectorResourceAgent",
     "header" => "InspectorResourceAgent.h",
     "domainAccessor" => "m_inspectorController->m_resourceAgent",
@@ -240,7 +240,7 @@ sub GenerateInterface
     push(@backendHead, "    static bool getCommandName(const String& message, String* result);");
     $backendConstructor = join("\n", @backendHead);
     $backendFooter = "    InspectorController* m_inspectorController;";
-    $backendTypes{"Controller"} = 1;
+    $backendTypes{"Inspector"} = 1;
     $backendTypes{"InspectorClient"} = 1;
     $backendTypes{"PassRefPtr"} = 1;
     $backendTypes{"Object"} = 1;
@@ -282,6 +282,7 @@ sub generateFrontendFunction
 
     my $functionName = $function->signature->name;
 
+    my $domain = $function->signature->extendedAttributes->{"domain"} || "Inspector";
     my @argsFiltered = grep($_->direction eq "out", @{$function->parameters}); # just keep only out parameters for frontend interface.
     map($frontendTypes{$_->type} = 1, @argsFiltered); # register required types.
     my $arguments = join(", ", map($typeTransform{$_->type}->{"param"} . " " . $_->name, @argsFiltered)); # prepare arguments for function signature.
@@ -295,6 +296,7 @@ sub generateFrontendFunction
         push(@function, "{");
         push(@function, "    RefPtr<InspectorObject> ${functionName}Message = InspectorObject::create();");
         push(@function, "    ${functionName}Message->setString(\"type\", \"event\");");
+        push(@function, "    ${functionName}Message->setString(\"domain\", \"$domain\");");
         push(@function, "    ${functionName}Message->setString(\"event\", \"$functionName\");");
         push(@function, "    RefPtr<InspectorObject> payloadDataObject = InspectorObject::create();");
         my @pushArguments = map("    payloadDataObject->set" . $typeTransform{$_->type}->{"JSONType"} . "(\"" . $_->name . "\", " . $_->name . ");", @argsFiltered);
@@ -340,7 +342,7 @@ sub generateBackendFunction
     push(@function, "    RefPtr<InspectorArray> protocolErrors = InspectorArray::create();");
     push(@function, "");
 
-    my $domain = $function->signature->extendedAttributes->{"handler"} || "Controller";
+    my $domain = $function->signature->extendedAttributes->{"domain"} || "Inspector";
     my $domainAccessor = $typeTransform{$domain}->{"domainAccessor"};
     $backendTypes{$domain} = 1;
     push(@function, "    if (!$domainAccessor)");
@@ -377,6 +379,7 @@ sub generateBackendFunction
     push(@function, "    if ((callId || protocolErrors->length()) && m_inspectorController->hasFrontend()) {");
     push(@function, "        RefPtr<InspectorObject> responseMessage = InspectorObject::create();");
     push(@function, "        responseMessage->setNumber(\"seq\", callId);");
+    push(@function, "        responseMessage->setString(\"domain\", \"$domain\");");
     push(@function, "        responseMessage->setBoolean(\"success\", !protocolErrors->length());");
     push(@function, "");
     push(@function, "        if (protocolErrors->length())");
@@ -547,7 +550,7 @@ sub generateBackendStubJS
 
     foreach my $function (@backendFunctions) {
         my $name = $function->signature->name;
-        my $domain = $function->signature->extendedAttributes->{"handler"};
+        my $domain = $function->signature->extendedAttributes->{"domain"};
         my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . lc($typeTransform{$_->type}->{"JSONType"}) . "\"", grep($_->direction eq "in", @{$function->parameters})));
         push(@JSStubs, "    this._registerDelegate('{" .
             "\"seq\": 0, " .
@@ -563,10 +566,12 @@ $licenseTemplate
 
 WebInspector.InspectorBackendStub = function()
 {
+    this._domainDispatchers = {};
 $JSStubs
 }
 
 WebInspector.InspectorBackendStub.prototype = {
+
     _registerDelegate: function(commandInfo)
     {
         var commandObject = JSON.parse(commandInfo);
@@ -604,6 +609,55 @@ WebInspector.InspectorBackendStub.prototype = {
 
         var message = JSON.stringify(request);
         InspectorFrontendHost.sendMessageToBackend(message);
+    },
+
+    registerDomainDispatcher: function(domain, dispatcher)
+    {
+        this._domainDispatchers[domain] = dispatcher;
+    },
+
+    dispatch: function(message)
+    {
+        if (window.dumpInspectorProtocolMessages)
+            console.log("backend: " + ((typeof message === "string") ? message : JSON.stringify(message)));
+
+        var messageObject = (typeof message === "string") ? JSON.parse(message) : message;
+
+        var arguments = [];
+        if (messageObject.data)
+            for (var key in messageObject.data)
+                arguments.push(messageObject.data[key]);
+
+        if ("seq" in messageObject) { // just a response for some request
+            if (messageObject.success)
+                WebInspector.Callback.processResponse(messageObject.seq, arguments);
+            else {
+                WebInspector.Callback.removeResponseCallbackEntry(messageObject.seq)
+                this.reportProtocolError(messageObject);
+            }
+            return;
+        }
+
+        if (messageObject.type === "event") {
+            if (!(messageObject.domain in this._domainDispatchers)) {
+                console.error("Protocol Error: the message is for non-existing domain '%s'", messageObject.domain);
+                return;
+            }
+            var dispatcher = this._domainDispatchers[messageObject.domain];
+            if (!(messageObject.event in dispatcher)) {
+                console.error("Protocol Error: Attempted to dispatch an unimplemented method '%s.%s'", messageObject.domain, messageObject.event);
+                return;
+            }
+            dispatcher[messageObject.event].apply(dispatcher, arguments);
+        }
+    },
+
+    reportProtocolError: function(messageObject)
+    {
+        console.error("Protocol Error: InspectorBackend request with seq = %d failed.", messageObject.seq);
+        for (var i = 0; i < messageObject.errors.length; ++i)
+            console.error("    " + messageObject.errors[i]);
+        WebInspector.Callback.removeResponseCallbackEntry(messageObject.seq);
     }
 }
 
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index 99b2fab..67a5cde 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -92,21 +92,21 @@ module core {
 #endif
 
         // This method is going to be broken down into smaller parts.
-        [handler=Controller] void populateScriptObjects();
+        [domain=Inspector] void populateScriptObjects();
 
-        [handler=Controller] void getInspectorState(out Object state);
+        [domain=Inspector] void getInspectorState(out Object state);
 
-        [handler=Controller] void setSearchingForNode(in boolean enabled, out boolean newState);
+        [domain=Inspector] void setSearchingForNode(in boolean enabled, out boolean newState);
 
-        [handler=Controller] void setMonitoringXHREnabled(in boolean enable, out boolean newState);
+        [domain=Inspector] void setMonitoringXHREnabled(in boolean enable, out boolean newState);
 
-        [handler=Controller] void reloadPage();
+        [domain=Inspector] void reloadPage();
 
-        [handler=Controller] void startTimelineProfiler();
-        [handler=Controller] void stopTimelineProfiler();
+        [domain=Inspector] void startTimelineProfiler();
+        [domain=Inspector] void stopTimelineProfiler();
 
-        [handler=Resource] void cachedResources(out Object resources);
-        [handler=Resource] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content);
+        [domain=Resources] void cachedResources(out Object resources);
+        [domain=Resources] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content);
         [notify] void identifierForInitialRequest(out long identifier, out String url, out Object loader);
         [notify] void willSendRequest(out long identifier, out double time, out Object request, out Object redirectResponse);
         [notify] void markResourceAsCached(out long identifier);
@@ -125,121 +125,121 @@ module core {
         [notify] void didCloseWebSocket(out unsigned long identifier, out double time);
 
 #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER
-        [handler=Backend] void enableDebugger(in boolean always);
-        [handler=Controller] void disableDebugger(in boolean always);
+        [domain=Backend] void enableDebugger(in boolean always);
+        [domain=Inspector] void disableDebugger(in boolean always);
 
-        [handler=Debug] void setBreakpoint(in String sourceID, in unsigned int lineNumber, in boolean enabled, in String condition, out boolean success, out unsigned int actualLineNumber);
-        [handler=Debug] void removeBreakpoint(in String sourceID, in unsigned long lineNumber);
-        [handler=Debug] void activateBreakpoints();
-        [handler=Debug] void deactivateBreakpoints();
+        [domain=Debugger] void setBreakpoint(in String sourceID, in unsigned int lineNumber, in boolean enabled, in String condition, out boolean success, out unsigned int actualLineNumber);
+        [domain=Debugger] void removeBreakpoint(in String sourceID, in unsigned long lineNumber);
+        [domain=Debugger] void activateBreakpoints();
+        [domain=Debugger] void deactivateBreakpoints();
 
-        [handler=Debug] void pause();
-        [handler=Debug] void resume();
+        [domain=Debugger] void pause();
+        [domain=Debugger] void resume();
 
-        [handler=Debug] void stepOverStatement();
-        [handler=Debug] void stepIntoStatement();
-        [handler=Debug] void stepOutOfFunction();
+        [domain=Debugger] void stepOverStatement();
+        [domain=Debugger] void stepIntoStatement();
+        [domain=Debugger] void stepOutOfFunction();
 
-        [handler=Debug] void setPauseOnExceptionsState(in long pauseOnExceptionsState, out long newState);
+        [domain=Debugger] void setPauseOnExceptionsState(in long pauseOnExceptionsState, out long newState);
 
-        [handler=Debug] void editScriptSource(in String sourceID, in String newContent, out boolean success, out String result, out Value newCallFrames);
-        [handler=Debug] void getScriptSource(in String sourceID, out String scriptSource);
+        [domain=Debugger] void editScriptSource(in String sourceID, in String newContent, out boolean success, out String result, out Value newCallFrames);
+        [domain=Debugger] void getScriptSource(in String sourceID, out String scriptSource);
 
-        [handler=Controller] void setNativeBreakpoint(in Object breakpoint, out String breakpointId);
-        [handler=Controller] void removeNativeBreakpoint(in String breakpointId);
+        [domain=Inspector] void setNativeBreakpoint(in Object breakpoint, out String breakpointId);
+        [domain=Inspector] void removeNativeBreakpoint(in String breakpointId);
 
-        [handler=Controller] void enableProfiler(in boolean always);
-        [handler=Controller] void disableProfiler(in boolean always);
+        [domain=Inspector] void enableProfiler(in boolean always);
+        [domain=Inspector] void disableProfiler(in boolean always);
 
-        [handler=Controller] void startProfiling();
-        [handler=Controller] void stopProfiling();
+        [domain=Inspector] void startProfiling();
+        [domain=Inspector] void stopProfiling();
 
-        [handler=Profiler] void getProfileHeaders(out Array headers);
-        [handler=Profiler] void getProfile(in String type, in unsigned long uid, out Object profile);
+        [domain=Profiler] void getProfileHeaders(out Array headers);
+        [domain=Profiler] void getProfile(in String type, in unsigned long uid, out Object profile);
 
-        [handler=Profiler] void removeProfile(in String type, in unsigned long uid);
-        [handler=Profiler] void clearProfiles();
+        [domain=Profiler] void removeProfile(in String type, in unsigned long uid);
+        [domain=Profiler] void clearProfiles();
 
-        [handler=Profiler] void takeHeapSnapshot();
+        [domain=Profiler] void takeHeapSnapshot();
 #endif
-        [handler=Backend] void setInjectedScriptSource(in String scriptSource);
-        [handler=Backend] void dispatchOnInjectedScript(in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException);
-        [handler=Controller] void addScriptToEvaluateOnLoad(in String scriptSource);
-        [handler=Controller] void removeAllScriptsToEvaluateOnLoad();
-
-        [handler=DOM] void getChildNodes(in long nodeId);
-        [handler=DOM] void setAttribute(in long elementId, in String name, in String value, out boolean success);
-        [handler=DOM] void removeAttribute(in long elementId, in String name, out boolean success);
-        [handler=DOM] void setTextNodeValue(in long nodeId, in String value, out boolean success);
-        [handler=DOM] void getEventListenersForNode(in long nodeId, out long outNodeId, out Array listenersArray);
-        [handler=DOM] void copyNode(in long nodeId);
-        [handler=DOM] void removeNode(in long nodeId, out long outNodeId);
-        [handler=DOM] void changeTagName(in long nodeId, in String newTagName, out long outNodeId);
-        [handler=DOM] void getOuterHTML(in long nodeId, out String outerHTML);
-        [handler=DOM] void setOuterHTML(in long nodeId, in String outerHTML, out long outNodeId);
-        [handler=DOM] void addInspectedNode(in long nodeId);
-        [handler=DOM] void performSearch(in String query, in boolean runSynchronously);
-        [handler=DOM] void searchCanceled();
-        [handler=DOM] void pushNodeByPathToFrontend(in String path, out long nodeId);
-
-        [handler=Controller] void setConsoleMessagesEnabled(in boolean enabled, out boolean newState);
+        [domain=Backend] void setInjectedScriptSource(in String scriptSource);
+        [domain=Backend] void dispatchOnInjectedScript(in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException);
+        [domain=Inspector] void addScriptToEvaluateOnLoad(in String scriptSource);
+        [domain=Inspector] void removeAllScriptsToEvaluateOnLoad();
+
+        [domain=DOM] void getChildNodes(in long nodeId);
+        [domain=DOM] void setAttribute(in long elementId, in String name, in String value, out boolean success);
+        [domain=DOM] void removeAttribute(in long elementId, in String name, out boolean success);
+        [domain=DOM] void setTextNodeValue(in long nodeId, in String value, out boolean success);
+        [domain=DOM] void getEventListenersForNode(in long nodeId, out long outNodeId, out Array listenersArray);
+        [domain=DOM] void copyNode(in long nodeId);
+        [domain=DOM] void removeNode(in long nodeId, out long outNodeId);
+        [domain=DOM] void changeTagName(in long nodeId, in String newTagName, out long outNodeId);
+        [domain=DOM] void getOuterHTML(in long nodeId, out String outerHTML);
+        [domain=DOM] void setOuterHTML(in long nodeId, in String outerHTML, out long outNodeId);
+        [domain=DOM] void addInspectedNode(in long nodeId);
+        [domain=DOM] void performSearch(in String query, in boolean runSynchronously);
+        [domain=DOM] void searchCanceled();
+        [domain=DOM] void pushNodeByPathToFrontend(in String path, out long nodeId);
+
+        [domain=Inspector] void setConsoleMessagesEnabled(in boolean enabled, out boolean newState);
         [notify] void addConsoleMessage(out Object messageObj);
         [notify] void updateConsoleMessageExpiredCount(out unsigned long count);
         [notify] void updateConsoleMessageRepeatCount(out unsigned long count);
 
-        [handler=Controller] void clearConsoleMessages();
+        [domain=Inspector] void clearConsoleMessages();
         [notify] void consoleMessagesCleared();
 
-        [handler=Controller] void highlightDOMNode(in long nodeId);
-        [handler=Controller] void hideDOMNodeHighlight();
-        [handler=Controller] void openInInspectedWindow(in String url);
-
-        [handler=Controller] void highlightFrame(in unsigned long frameId);
-        [handler=Controller] void hideFrameHighlight();
-
-        [handler=CSS] void getStylesForNode2(in long nodeId, out Value styles);
-        [handler=CSS] void getComputedStyleForNode2(in long nodeId, out Value style);
-        [handler=CSS] void getInlineStyleForNode2(in long nodeId, out Value style);
-        [handler=CSS] void getAllStyles2(out Array styleSheetIds);
-        [handler=CSS] void getStyleSheet2(in String styleSheetId, out Value styleSheet);
-        [handler=CSS] void getStyleSheetText2(in String styleSheetId, out String url, out String text);
-        [handler=CSS] void setStyleSheetText2(in String styleSheetId, in String text, out boolean success);
-        [handler=CSS] void setPropertyText2(in Object styleId, in long propertyIndex, in String text, in boolean overwrite, out Value style);
-        [handler=CSS] void toggleProperty2(in Object styleId, in long propertyIndex, in boolean disable, out Value style);
-        [handler=CSS] void setRuleSelector2(in Object ruleId, in String selector, out Value rule);
-        [handler=CSS] void addRule2(in long contextNodeId, in String selector, out Value rule);
-        [handler=CSS] void getSupportedCSSProperties(out Array cssProperties);
-        [handler=CSS] void querySelectorAll(in long documentId, in String selector, out Array result);
-
-        [handler=Controller] void getCookies(out Array cookies, out String cookiesString);
-        [handler=Controller] void deleteCookie(in String cookieName, in String domain);
+        [domain=Inspector] void highlightDOMNode(in long nodeId);
+        [domain=Inspector] void hideDOMNodeHighlight();
+        [domain=Inspector] void openInInspectedWindow(in String url);
+
+        [domain=Inspector] void highlightFrame(in unsigned long frameId);
+        [domain=Inspector] void hideFrameHighlight();
+
+        [domain=CSS] void getStylesForNode2(in long nodeId, out Value styles);
+        [domain=CSS] void getComputedStyleForNode2(in long nodeId, out Value style);
+        [domain=CSS] void getInlineStyleForNode2(in long nodeId, out Value style);
+        [domain=CSS] void getAllStyles2(out Array styleSheetIds);
+        [domain=CSS] void getStyleSheet2(in String styleSheetId, out Value styleSheet);
+        [domain=CSS] void getStyleSheetText2(in String styleSheetId, out String url, out String text);
+        [domain=CSS] void setStyleSheetText2(in String styleSheetId, in String text, out boolean success);
+        [domain=CSS] void setPropertyText2(in Object styleId, in long propertyIndex, in String text, in boolean overwrite, out Value style);
+        [domain=CSS] void toggleProperty2(in Object styleId, in long propertyIndex, in boolean disable, out Value style);
+        [domain=CSS] void setRuleSelector2(in Object ruleId, in String selector, out Value rule);
+        [domain=CSS] void addRule2(in long contextNodeId, in String selector, out Value rule);
+        [domain=CSS] void getSupportedCSSProperties(out Array cssProperties);
+        [domain=CSS] void querySelectorAll(in long documentId, in String selector, out Array result);
+
+        [domain=Inspector] void getCookies(out Array cookies, out String cookiesString);
+        [domain=Inspector] void deleteCookie(in String cookieName, in String domain);
 
 #if defined(ENABLE_OFFLINE_WEB_APPLICATIONS) && ENABLE_OFFLINE_WEB_APPLICATIONS
-        [handler=ApplicationCache] void getApplicationCaches(out Value applicationCaches);
+        [domain=ApplicationCache] void getApplicationCaches(out Value applicationCaches);
 #endif
 
 #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM
-        [handler=FileSystem] void getFileSystemPathAsync(in unsigned int type, in String origin);
-        [handler=FileSystem] void revealFolderInOS(in String path);
+        [domain=FileSystem] void getFileSystemPathAsync(in unsigned int type, in String origin);
+        [domain=FileSystem] void revealFolderInOS(in String path);
         [notify] void didGetFileSystemPath(out String root, out int type, out String origin);
         [notify] void didGetFileSystemError(out int type, out String origin);
         [notify] void didGetFileSystemDisabled();
 #endif
 
-        [handler=Backend] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
-        [handler=Controller] void didEvaluateForTestInFrontend(in long testCallId, in String jsonResult);
+        [domain=Backend] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
+        [domain=Inspector] void didEvaluateForTestInFrontend(in long testCallId, in String jsonResult);
 
 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE
-        [handler=Backend] void getDatabaseTableNames(in long databaseId, out Array tableNames);
-        [handler=Backend] void executeSQL(in long databaseId, in String query, out boolean success, out long transactionId);
+        [domain=Backend] void getDatabaseTableNames(in long databaseId, out Array tableNames);
+        [domain=Backend] void executeSQL(in long databaseId, in String query, out boolean success, out long transactionId);
         [notify] void sqlTransactionSucceeded(out long transactionId, out Value columnNames, out Value values);
         [notify] void sqlTransactionFailed(out long transactionId, out Value sqlError);
 #endif
 
 #if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE
-        [handler=Controller] void getDOMStorageEntries(in long storageId, out Array entries);
-        [handler=Controller] void setDOMStorageItem(in long storageId, in String key, in String value, out boolean success);
-        [handler=Controller] void removeDOMStorageItem(in long storageId, in String key, out boolean success);
+        [domain=Inspector] void getDOMStorageEntries(in long storageId, out Array entries);
+        [domain=Inspector] void setDOMStorageItem(in long storageId, in String key, in String value, out boolean success);
+        [domain=Inspector] void removeDOMStorageItem(in long storageId, in String key, out boolean success);
 #endif
     };
 }
diff --git a/WebCore/inspector/front-end/Callback.js b/WebCore/inspector/front-end/Callback.js
index 0621fd1..8e3f1d7 100644
--- a/WebCore/inspector/front-end/Callback.js
+++ b/WebCore/inspector/front-end/Callback.js
@@ -57,5 +57,5 @@ WebInspector.Callback.prototype = {
 
 WebInspector.Callback._INSTANCE = new WebInspector.Callback();
 WebInspector.Callback.wrap = WebInspector.Callback._INSTANCE.wrap.bind(WebInspector.Callback._INSTANCE);
-WebInspector.processResponse = WebInspector.Callback._INSTANCE.processResponse.bind(WebInspector.Callback._INSTANCE);
-WebInspector.removeResponseCallbackEntry = WebInspector.Callback._INSTANCE.removeResponseCallbackEntry.bind(WebInspector.Callback._INSTANCE);
+WebInspector.Callback.processResponse = WebInspector.Callback._INSTANCE.processResponse.bind(WebInspector.Callback._INSTANCE);
+WebInspector.Callback.removeResponseCallbackEntry = WebInspector.Callback._INSTANCE.removeResponseCallbackEntry.bind(WebInspector.Callback._INSTANCE);
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index 37bf549..24e29ec 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -80,6 +80,8 @@ WebInspector.DOMNode = function(doc, payload) {
         this.name = payload.name;
         this.value = payload.value;
     }
+
+    InspectorBackend.registerDomainDispatcher("DOM", this);
 }
 
 WebInspector.DOMNode.prototype = {
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 51145cf..f71b89a 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -478,7 +478,7 @@ WebInspector.loaded = function()
 {
     if ("page" in WebInspector.queryParamsObject) {
         WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector.queryParamsObject.page);
-        WebInspector.socket.onmessage = function(message) { WebInspector_syncDispatch(message.data); }
+        WebInspector.socket.onmessage = function(message) { InspectorBackend.dispatch(message.data); }
         WebInspector.socket.onerror = function(error) { console.error(error); }
         WebInspector.socket.onopen = function() {
             InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket);
@@ -520,6 +520,8 @@ WebInspector.doLoadedDone = function()
     this.resourceManager = new WebInspector.ResourceManager();
     this.domAgent = new WebInspector.DOMAgent();
 
+    InspectorBackend.registerDomainDispatcher("Inspector", this);
+
     this.resourceCategories = {
         documents: new WebInspector.ResourceCategory("documents", WebInspector.UIString("Documents"), "rgb(47,102,236)"),
         stylesheets: new WebInspector.ResourceCategory("stylesheets", WebInspector.UIString("Stylesheets"), "rgb(157,231,119)"),
@@ -648,58 +650,18 @@ WebInspector.dispatch = function(message) {
     // This is important to LayoutTests.
     function delayDispatch()
     {
-        WebInspector_syncDispatch(message);
+        InspectorBackend.dispatch(message);
         WebInspector.pendingDispatches--;
     }
     WebInspector.pendingDispatches++;
     setTimeout(delayDispatch, 0);
 }
 
-// This function is purposely put into the global scope for easy access.
-WebInspector_syncDispatch = function(message)
-{
-    if (window.dumpInspectorProtocolMessages)
-        console.log("backend: " + ((typeof message === "string") ? message : JSON.stringify(message)));
-
-    var messageObject = (typeof message === "string") ? JSON.parse(message) : message;
-
-    var arguments = [];
-    if (messageObject.data)
-        for (var key in messageObject.data)
-            arguments.push(messageObject.data[key]);
-
-    if ("seq" in messageObject) { // just a response for some request
-        if (messageObject.success)
-            WebInspector.processResponse(messageObject.seq, arguments);
-        else {
-            WebInspector.removeResponseCallbackEntry(messageObject.seq)
-            WebInspector.reportProtocolError(messageObject);
-        }
-        return;
-    }
-
-    if (messageObject.type === "event") {
-        if (!(messageObject.event in WebInspector)) {
-            console.error("Protocol Error: Attempted to dispatch an unimplemented WebInspector method '%s'", messageObject.event);
-            return;
-        }
-        WebInspector[messageObject.event].apply(WebInspector, arguments);
-    }
-}
-
 WebInspector.dispatchMessageFromBackend = function(messageObject)
 {
     WebInspector.dispatch(messageObject);
 }
 
-WebInspector.reportProtocolError = function(messageObject)
-{
-    console.error("Protocol Error: InspectorBackend request with seq = %d failed.", messageObject.seq);
-    for (var i = 0; i < messageObject.errors.length; ++i)
-        console.error("    " + messageObject.errors[i]);
-    WebInspector.removeResponseCallbackEntry(messageObject.seq);
-}
-
 WebInspector.windowResize = function(event)
 {
     if (this.currentPanel)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list