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

loislo at chromium.org loislo at chromium.org
Wed Dec 22 11:44:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit dddc97bac6e4481e992e0055b4b5a7e2af98c706
Author: loislo at chromium.org <loislo at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 19:17:08 2010 +0000

    2010-08-05  Ilya Tikhonovsky  <loislo at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            WebInspector: In the current implementation of inspector agents we're calling
            did methods manually. That is error prone and is bad from protocol point of view.
            It would be better to call did methods automatically from the corresponding methods
            of InspectorBackendDispatcher and report the results. As far as our protocol is
            statefull this trick will keep it in the consistent state.
            https://bugs.webkit.org/show_bug.cgi?id=43489
    
            * inspector/CodeGeneratorInspector.pm:
            * inspector/Inspector.idl:
            * inspector/InspectorApplicationCacheAgent.cpp:
            (WebCore::InspectorApplicationCacheAgent::getApplicationCaches):
            * inspector/InspectorApplicationCacheAgent.h:
            * inspector/InspectorBackend.cpp:
            (WebCore::InspectorBackend::getProfilerLogLines):
            (WebCore::InspectorBackend::setInjectedScriptSource):
            (WebCore::InspectorBackend::dispatchOnInjectedScript):
            (WebCore::InspectorBackend::clearConsoleMessages):
            (WebCore::InspectorBackend::releaseWrapperObjectGroup):
            (WebCore::InspectorBackend::getDatabaseTableNames):
            * inspector/InspectorBackend.h:
            * inspector/InspectorCSSStore.cpp:
            (WebCore::InspectorCSSStore::inspectorStyleSheet):
            * inspector/InspectorCSSStore.h:
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::InspectorController):
            (WebCore::InspectorController::getCookies):
            (WebCore::InspectorController::getDOMStorageEntries):
            (WebCore::InspectorController::setDOMStorageItem):
            (WebCore::InspectorController::removeDOMStorageItem):
            (WebCore::InspectorController::getProfileHeaders):
            (WebCore::InspectorController::getProfile):
            (WebCore::InspectorController::editScriptSource):
            (WebCore::InspectorController::getScriptSource):
            (WebCore::InspectorController::setBreakpoint):
            (WebCore::InspectorController::getResourceContent):
            * inspector/InspectorController.h:
            (WebCore::InspectorController::inspectorClient):
            * inspector/InspectorDOMAgent.cpp:
            (WebCore::InspectorDOMAgent::getChildNodes):
            (WebCore::InspectorDOMAgent::setAttribute):
            (WebCore::InspectorDOMAgent::removeAttribute):
            (WebCore::InspectorDOMAgent::removeNode):
            (WebCore::InspectorDOMAgent::changeTagName):
            (WebCore::InspectorDOMAgent::getOuterHTML):
            (WebCore::InspectorDOMAgent::setOuterHTML):
            (WebCore::InspectorDOMAgent::setTextNodeValue):
            (WebCore::InspectorDOMAgent::getEventListenersForNode):
            (WebCore::InspectorDOMAgent::getStyles):
            (WebCore::InspectorDOMAgent::getAllStyles):
            (WebCore::InspectorDOMAgent::getStyleSheet):
            (WebCore::InspectorDOMAgent::getRuleRanges):
            (WebCore::InspectorDOMAgent::getInlineStyle):
            (WebCore::InspectorDOMAgent::getComputedStyle):
            (WebCore::InspectorDOMAgent::applyStyleText):
            (WebCore::InspectorDOMAgent::setStyleText):
            (WebCore::InspectorDOMAgent::setStyleProperty):
            (WebCore::InspectorDOMAgent::toggleStyleEnabled):
            (WebCore::InspectorDOMAgent::setRuleSelector):
            (WebCore::InspectorDOMAgent::addRule):
            (WebCore::InspectorDOMAgent::buildObjectForRule):
            (WebCore::InspectorDOMAgent::pushNodeByPathToFrontend):
            * inspector/InspectorDOMAgent.h:
            * inspector/InspectorValues.cpp:
            (WebCore::InspectorValue::asNumber):
            (WebCore::InspectorBasicValue::asNumber):
            * inspector/InspectorValues.h:
            * inspector/front-end/Callback.js:
            (WebInspector.Callback.prototype.processCallback):
            (WebInspector.Callback.prototype.removeCallbackEntry):
            * inspector/front-end/ElementsPanel.js:
            (WebInspector.ElementsPanel.prototype.reset):
            * inspector/front-end/inspector.js:
            (WebInspector.reportProtocolError):
    
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64770 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 51b6c6e..67635cd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,81 @@
+2010-08-05  Ilya Tikhonovsky  <loislo at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        WebInspector: In the current implementation of inspector agents we're calling
+        did methods manually. That is error prone and is bad from protocol point of view.
+        It would be better to call did methods automatically from the corresponding methods
+        of InspectorBackendDispatcher and report the results. As far as our protocol is
+        statefull this trick will keep it in the consistent state.
+        https://bugs.webkit.org/show_bug.cgi?id=43489
+
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/Inspector.idl:
+        * inspector/InspectorApplicationCacheAgent.cpp:
+        (WebCore::InspectorApplicationCacheAgent::getApplicationCaches):
+        * inspector/InspectorApplicationCacheAgent.h:
+        * inspector/InspectorBackend.cpp:
+        (WebCore::InspectorBackend::getProfilerLogLines):
+        (WebCore::InspectorBackend::setInjectedScriptSource):
+        (WebCore::InspectorBackend::dispatchOnInjectedScript):
+        (WebCore::InspectorBackend::clearConsoleMessages):
+        (WebCore::InspectorBackend::releaseWrapperObjectGroup):
+        (WebCore::InspectorBackend::getDatabaseTableNames):
+        * inspector/InspectorBackend.h:
+        * inspector/InspectorCSSStore.cpp:
+        (WebCore::InspectorCSSStore::inspectorStyleSheet):
+        * inspector/InspectorCSSStore.h:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        (WebCore::InspectorController::getCookies):
+        (WebCore::InspectorController::getDOMStorageEntries):
+        (WebCore::InspectorController::setDOMStorageItem):
+        (WebCore::InspectorController::removeDOMStorageItem):
+        (WebCore::InspectorController::getProfileHeaders):
+        (WebCore::InspectorController::getProfile):
+        (WebCore::InspectorController::editScriptSource):
+        (WebCore::InspectorController::getScriptSource):
+        (WebCore::InspectorController::setBreakpoint):
+        (WebCore::InspectorController::getResourceContent):
+        * inspector/InspectorController.h:
+        (WebCore::InspectorController::inspectorClient):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::getChildNodes):
+        (WebCore::InspectorDOMAgent::setAttribute):
+        (WebCore::InspectorDOMAgent::removeAttribute):
+        (WebCore::InspectorDOMAgent::removeNode):
+        (WebCore::InspectorDOMAgent::changeTagName):
+        (WebCore::InspectorDOMAgent::getOuterHTML):
+        (WebCore::InspectorDOMAgent::setOuterHTML):
+        (WebCore::InspectorDOMAgent::setTextNodeValue):
+        (WebCore::InspectorDOMAgent::getEventListenersForNode):
+        (WebCore::InspectorDOMAgent::getStyles):
+        (WebCore::InspectorDOMAgent::getAllStyles):
+        (WebCore::InspectorDOMAgent::getStyleSheet):
+        (WebCore::InspectorDOMAgent::getRuleRanges):
+        (WebCore::InspectorDOMAgent::getInlineStyle):
+        (WebCore::InspectorDOMAgent::getComputedStyle):
+        (WebCore::InspectorDOMAgent::applyStyleText):
+        (WebCore::InspectorDOMAgent::setStyleText):
+        (WebCore::InspectorDOMAgent::setStyleProperty):
+        (WebCore::InspectorDOMAgent::toggleStyleEnabled):
+        (WebCore::InspectorDOMAgent::setRuleSelector):
+        (WebCore::InspectorDOMAgent::addRule):
+        (WebCore::InspectorDOMAgent::buildObjectForRule):
+        (WebCore::InspectorDOMAgent::pushNodeByPathToFrontend):
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorValues.cpp:
+        (WebCore::InspectorValue::asNumber):
+        (WebCore::InspectorBasicValue::asNumber):
+        * inspector/InspectorValues.h:
+        * inspector/front-end/Callback.js:
+        (WebInspector.Callback.prototype.processCallback):
+        (WebInspector.Callback.prototype.removeCallbackEntry):
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.prototype.reset):
+        * inspector/front-end/inspector.js:
+        (WebInspector.reportProtocolError):
+
 2010-08-04  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/inspector/CodeGeneratorInspector.pm b/WebCore/inspector/CodeGeneratorInspector.pm
index 0ae9e85..dcec6c9 100644
--- a/WebCore/inspector/CodeGeneratorInspector.pm
+++ b/WebCore/inspector/CodeGeneratorInspector.pm
@@ -17,12 +17,11 @@ $typeTransform{"InspectorClient"} = {
 $typeTransform{"Backend"} = {
     "forward" => "InspectorBackend",
     "header" => "InspectorBackend.h",
-    "handlerAccessor" => "m_inspectorBackend",
+    "handlerAccessor" => "m_inspectorController->inspectorBackend()",
 };
 $typeTransform{"Controller"} = {
-    "forward" => "InspectorController",
-    "header" => "InspectorController.h",
-    "handlerAccessor" => "m_inspectorBackend->inspectorController()",
+    "forwardHeader" => "InspectorController.h",
+    "handlerAccessor" => "m_inspectorController",
 };
 $typeTransform{"Debug"} = {
     "forward" => "ScriptDebugServer",
@@ -32,12 +31,16 @@ $typeTransform{"Debug"} = {
 $typeTransform{"DOM"} = {
     "forward" => "InspectorDOMAgent",
     "header" => "InspectorDOMAgent.h",
-    "handlerAccessor" => "m_inspectorBackend->inspectorDOMAgent()",
+    "handlerAccessor" => "m_inspectorController->domAgent()",
 };
 $typeTransform{"ApplicationCache"} = {
     "forward" => "InspectorApplicationCacheAgent",
     "header" => "InspectorApplicationCacheAgent.h",
-    "handlerAccessor" => "m_inspectorBackend->inspectorApplicationCacheAgent()",
+    "handlerAccessor" => "m_inspectorController->applicationCacheAgent()",
+};
+$typeTransform{"Frontend"} = {
+    "forward" => "RemoteInspectorFrontend",
+    "header" => "RemoteInspectorFrontend.h",
 };
 $typeTransform{"PassRefPtr"} = {
     "forwardHeader" => "wtf/PassRefPtr.h",
@@ -45,6 +48,8 @@ $typeTransform{"PassRefPtr"} = {
 $typeTransform{"Object"} = {
     "param" => "PassRefPtr<InspectorObject>",
     "retVal" => "PassRefPtr<InspectorObject>",
+    "variable" => "RefPtr<InspectorObject>",
+    "defaultValue" => "InspectorObject::create()",
     "forward" => "InspectorObject",
     "header" => "InspectorValues.h",
     "accessorSuffix" => ""
@@ -52,6 +57,8 @@ $typeTransform{"Object"} = {
 $typeTransform{"Array"} = {
     "param" => "PassRefPtr<InspectorArray>",
     "retVal" => "PassRefPtr<InspectorArray>",
+    "variable" => "RefPtr<InspectorArray>",
+    "defaultValue" => "InspectorArray::create()",
     "forward" => "InspectorArray",
     "header" => "InspectorValues.h",
     "accessorSuffix" => ""
@@ -59,41 +66,55 @@ $typeTransform{"Array"} = {
 $typeTransform{"Value"} = {
     "param" => "PassRefPtr<InspectorValue>",
     "retVal" => "PassRefPtr<InspectorValue>",
+    "variable" => "RefPtr<InspectorValue>",
+    "defaultValue" => "InspectorValue::null()",
     "forward" => "InspectorValue",
     "header" => "InspectorValues.h",
     "accessorSuffix" => ""
 };
 $typeTransform{"String"} = {
     "param" => "const String&",
-    "retVal" => "String",
+    "variable" => "String",
     "forward" => "String",
     "header" => "PlatformString.h",
     "accessorSuffix" => "String"
 };
 $typeTransform{"long"} = {
     "param" => "long",
-    "retVal" => "long",
+    "variable" => "long",
+    "defaultValue" => "0",
     "forward" => "",
     "header" => "",
     "accessorSuffix" => "Number"
 };
 $typeTransform{"int"} = {
     "param" => "int",
-    "retVal" => "int",
+    "variable" => "int",
+    "defaultValue" => "0",
     "forward" => "",
     "header" => "",
     "accessorSuffix" => "Number",
 };
 $typeTransform{"unsigned long"} = {
     "param" => "unsigned long",
-    "retVal" => "unsigned long",
+    "variable" => "unsigned long",
+    "defaultValue" => "0u",
+    "forward" => "",
+    "header" => "",
+    "accessorSuffix" => "Number"
+};
+$typeTransform{"unsigned int"} = {
+    "param" => "unsigned int",
+    "variable" => "unsigned int",
+    "defaultValue" => "0u",
     "forward" => "",
     "header" => "",
     "accessorSuffix" => "Number"
 };
 $typeTransform{"boolean"} = {
     "param" => "bool",
-    "retVal"=> "bool",
+    "variable"=> "bool",
+    "defaultValue" => "false",
     "forward" => "",
     "header" => "",
     "accessorSuffix" => "Bool"
@@ -184,12 +205,15 @@ sub GenerateInterface
 
     $backendClassName = $className . "BackendDispatcher";
     my @backendHead;
-    push(@backendHead, "    ${backendClassName}(InspectorBackend* inspectorBackend) : m_inspectorBackend(inspectorBackend) { }");
+    push(@backendHead, "    ${backendClassName}(InspectorController* inspectorController) : m_inspectorController(inspectorController) { }");
+    push(@backendHead, "    RemoteInspectorFrontend* inspectorFrontend() const { return m_inspectorController->remoteInspectorFrontend(); }");
+    push(@backendHead, "    void reportProtocolError(const long callId, const String& method, const String& errorText) const;");
     push(@backendHead, "    void dispatch(const String& message);");
     push(@backendHead, "private:");
     $backendConstructor = join("\n", @backendHead);
-    $backendFooter = "    InspectorBackend* m_inspectorBackend;";
-    $backendTypes{"Backend"} = 1;
+    $backendFooter = "    InspectorController* m_inspectorController;";
+    $backendTypes{"Controller"} = 1;
+    $backendTypes{"InspectorClient"} = 1;
     $backendTypes{"PassRefPtr"} = 1;
     $backendTypes{"Array"} = 1;
 
@@ -206,6 +230,7 @@ sub generateFunctions
         generateBackendFunction($function);
     }
     push(@backendMethodsImpl, generateBackendDispatcher());
+    push(@backendMethodsImpl, generateBackendReportProtocolError());
 }
 
 sub generateFrontendFunction
@@ -249,12 +274,12 @@ sub generateBackendPrivateFunctions
     my $privateFunctions = << "EOF";
 static String formatWrongArgumentsCountMessage(unsigned expected, unsigned actual)
 {
-    return String::format(\"Wrong number of parameters: %d (expected: %d)\", actual, expected);
+    return String::format("Wrong number of parameters: %d (expected: %d)", actual, expected);
 }
 
 static String formatWrongArgumentTypeMessage(unsigned position, const char* name, const char* expectedType)
 {
-    return String::format(\"Failed to convert parameter %d (%s) to %s\", position, name, expectedType);
+    return String::format("Failed to convert parameter %d (%s) to %s", position, name, expectedType);
 }
 EOF
     push(@backendMethodsImpl, $privateFunctions);
@@ -267,46 +292,101 @@ sub generateBackendFunction
 
     my $functionName = $function->signature->name;
 
-    my @argsFiltered = grep($_->direction eq "in", @{$function->parameters});
-    map($backendTypes{$_->type} = 1, @argsFiltered); # register required types
-    my $arguments = join(", ", map($typeTransform{$_->type}->{"param"} . " " . $_->name, @argsFiltered));
+    map($backendTypes{$_->type} = 1, @{$function->parameters}); # register required types
+    my @inArgs = grep($_->direction eq "in", @{$function->parameters});
+    my @outArgs = grep($_->direction eq "out", @{$function->parameters});
 
-    my $signature = "    void ${functionName}(PassRefPtr<InspectorArray> args, String* exception);";
+    my $signature = "    void ${functionName}(PassRefPtr<InspectorArray> args);";
     !$backendMethods{${signature}} || die "Duplicate function was detected for signature '$signature'.";
     $backendMethods{${signature}} = $functionName;
 
     my @function;
-    push(@function, "void ${backendClassName}::${functionName}(PassRefPtr<InspectorArray> args, String* exception)");
+    push(@function, "void ${backendClassName}::${functionName}(PassRefPtr<InspectorArray> args)");
     push(@function, "{");
-    my $i = 1; # zero element is the method name.
-    my $expectedParametersCount = scalar(@argsFiltered);
-    my $expectedParametersCountWithMethodName = scalar(@argsFiltered) + 1;
+    push(@function, "    DEFINE_STATIC_LOCAL(String, backendFunctionName, (\"$functionName\"));");
+    push(@function, "    long callId = 0;");
+    push(@function, "");
+
+    my $expectedParametersCount = scalar(@inArgs);
+    my $expectedParametersCountWithMethodName = scalar(@inArgs) + 1;
     push(@function, "    if (args->length() != $expectedParametersCountWithMethodName) {");
-    push(@function, "        *exception = formatWrongArgumentsCountMessage(args->length() - 1, $expectedParametersCount);");
     push(@function, "        ASSERT_NOT_REACHED();");
+    push(@function, "        reportProtocolError(callId, backendFunctionName, formatWrongArgumentsCountMessage(args->length() - 1, $expectedParametersCount));");
     push(@function, "        return;");
     push(@function, "    }");
+    push(@function, "");
 
-    foreach my $parameter (@argsFiltered) {
-        my $parameterType = $parameter->type;
-        push(@function, "    " . $typeTransform{$parameterType}->{"retVal"} . " " . $parameter->name . ";");
-        push(@function, "    if (!args->get(" . $i . ")->as" . $typeTransform{$parameterType}->{"accessorSuffix"} . "(&" . $parameter->name . ")) {");
-        push(@function, "        *exception = formatWrongArgumentTypeMessage($i, \"" . $parameter->name . "\", \"$parameterType\");");
+    my $i = 1; # zero element is the method name.
+    foreach my $parameter (@inArgs) {
+        my $type = $parameter->type;
+        my $argumentType = $typeTransform{$type}->{$typeTransform{$type}->{"retVal"} ? "retVal" : "variable"};
+        push(@function, "    $argumentType " . $parameter->name . ";") if !($parameter->name eq "callId");
+        push(@function, "    if (!args->get($i)->as" . $typeTransform{$type}->{"accessorSuffix"} . "(&" . $parameter->name . ")) {");
         push(@function, "        ASSERT_NOT_REACHED();");
+        push(@function, "        reportProtocolError(callId, backendFunctionName, formatWrongArgumentTypeMessage($i, \"" . $parameter->name . "\", \"$type\"));");
         push(@function, "        return;");
         push(@function, "    }");
+        push(@function, "");
         ++$i;
     }
-    my $handler = $function->signature->extendedAttributes->{"handler"} || "Backend";
+
+    my $handler = $function->signature->extendedAttributes->{"handler"} || "Controller";
     my $handlerAccessor = $typeTransform{$handler}->{"handlerAccessor"};
     $backendTypes{$handler} = 1;
-    push(@function, "    if ($handlerAccessor)");
-    push(@function, "        $handlerAccessor->$functionName(" . join(", ", map($_->name, @argsFiltered)) . ");");
+    push(@function, "    if (!$handlerAccessor) {");
+    push(@function, "        reportProtocolError(callId, backendFunctionName, \"Error: $handler handler is not available.\");");
+    push(@function, "        return;");
+    push(@function, "    }");
+    push(@function, "");
+
+
+    foreach (@outArgs) { # declare local variables for out arguments.
+        my $initializer = $typeTransform{$_->type}->{"defaultValue"} ? " = " . $typeTransform{$_->type}->{"defaultValue"} : "";
+        push(@function, "    " . $typeTransform{$_->type}->{"variable"} . " " . $_->name . "$initializer;");
+    }
+
+
+    my $args = join(", ", (map($_->name, @inArgs), map("&" . $_->name, @outArgs)));
+    push(@function, "    $handlerAccessor->$functionName($args);");
+
+    # The results of function call should be transfered back to frontend (except async methods - need to fix that).
+    if (scalar(grep($_->name eq "callId", @inArgs)) && !$function->signature->extendedAttributes->{"async"}) {
+        my @pushArguments = map("        arguments->push" . $typeTransform{$_->type}->{"accessorSuffix"} . "(" . $_->name . ");", @outArgs);
+        my $customResponse = $function->signature->extendedAttributes->{"customResponse"};
+        my $didFunctionName = $customResponse ? $customResponse : "did" . ucfirst($function->signature->name);
+
+        push(@function, "");
+        push(@function, "    // use InspectorFrontend as a marker of WebInspector availability");
+        push(@function, "    if (m_inspectorController->remoteInspectorFrontend()) {");
+        push(@function, "        RefPtr<InspectorArray> arguments = InspectorArray::create();");
+        push(@function, "        arguments->pushString(\"$didFunctionName\");");
+        push(@function, "        arguments->pushNumber(callId);");
+        push(@function, @pushArguments);
+        push(@function, "        m_inspectorController->inspectorClient()->sendMessageToFrontend(arguments->toJSONString());");
+        push(@function, "    }");
+    }
     push(@function, "}");
     push(@function, "");
     push(@backendMethodsImpl, @function);
 }
 
+sub generateBackendReportProtocolError
+{
+    my $reportProtocolError = << "EOF";
+
+void ${backendClassName}::reportProtocolError(const long callId, const String& method, const String& errorText) const
+{
+    RefPtr<InspectorArray> arguments = InspectorArray::create();
+    arguments->pushString("reportProtocolError");
+    arguments->pushNumber(callId);
+    arguments->pushString(method);
+    arguments->pushString(errorText);
+    m_inspectorController->inspectorClient()->sendMessageToFrontend(arguments->toJSONString());
+}
+EOF
+    return split("\n", $reportProtocolError);
+}
+
 sub generateBackendDispatcher
 {
     my @body;
@@ -315,8 +395,7 @@ sub generateBackendDispatcher
 
     push(@body, "void ${backendClassName}::dispatch(const String& message)");
     push(@body, "{");
-    push(@body, "    String exception;");
-    push(@body, "    typedef void (${backendClassName}::*CallHandler)(PassRefPtr<InspectorArray> args, String* exception);");
+    push(@body, "    typedef void (${backendClassName}::*CallHandler)(PassRefPtr<InspectorArray> args);");
     push(@body, "    typedef HashMap<String, CallHandler> DispatchMap;");
     push(@body, "    DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, );");
     push(@body, "    if (dispatchMap.isEmpty()) {");
@@ -326,38 +405,38 @@ sub generateBackendDispatcher
     push(@body, "    RefPtr<InspectorValue> parsedMessage = InspectorValue::parseJSON(message);");
     push(@body, "    if (!parsedMessage) {");
     push(@body, "        ASSERT_NOT_REACHED();");
-    push(@body, "        exception = \"Error: Invalid message format. Message should be in JSON format.\";");
+    push(@body, "        reportProtocolError(0, \"dispatch\", \"Error: Invalid message format. Message should be in JSON format.\");");
     push(@body, "        return;");
     push(@body, "    }");
     push(@body, "");
     push(@body, "    RefPtr<InspectorArray> messageArray = parsedMessage->asArray();");
     push(@body, "    if (!messageArray) {");
     push(@body, "        ASSERT_NOT_REACHED();");
-    push(@body, "        exception = \"Error: Invalid message format. The message should be a JSONified array of arguments.\";");
+    push(@body, "        reportProtocolError(0, \"dispatch\", \"Error: Invalid message format. The message should be a JSONified array of arguments.\");");
     push(@body, "        return;");
     push(@body, "    }");
     push(@body, "");
     push(@body, "    if (!messageArray->length()) {");
     push(@body, "        ASSERT_NOT_REACHED();");
-    push(@body, "        exception = \"Error: Invalid message format. Empty message was received.\";");
+    push(@body, "        reportProtocolError(0, \"dispatch\", \"Error: Invalid message format. Empty message was received.\");");
     push(@body, "        return;");
     push(@body, "    }");
     push(@body, "");
     push(@body, "    String methodName;");
     push(@body, "    if (!messageArray->get(0)->asString(&methodName)) {");
     push(@body, "        ASSERT_NOT_REACHED();");
-    push(@body, "        exception = \"Error: Invalid message format. The first element of the message should be method name.\";");
+    push(@body, "        reportProtocolError(0, \"dispatch\", \"Error: Invalid message format. The first element of the message should be method name.\");");
     push(@body, "        return;");
     push(@body, "    }");
     push(@body, "");
     push(@body, "    HashMap<String, CallHandler>::iterator it = dispatchMap.find(methodName);");
     push(@body, "    if (it == dispatchMap.end()) {");
     push(@body, "        ASSERT_NOT_REACHED();");
-    push(@body, "        exception = String::format(\"Error: Invalid method name. '%s' wasn't found.\", methodName.utf8().data());");
+    push(@body, "        reportProtocolError(0, \"dispatch\", String::format(\"Error: Invalid method name. '%s' wasn't found.\", methodName.utf8().data()));");
     push(@body, "        return;");
     push(@body, "    }");
     push(@body, "");
-    push(@body, "    ((*this).*it->second)(messageArray, &exception);");
+    push(@body, "    ((*this).*it->second)(messageArray);");
     push(@body, "}");
     return @body;
 }
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index cea683b..099f184 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -88,7 +88,7 @@ module core {
         [handler=Backend] void enableDebugger(in boolean always);
         [handler=Controller] void disableDebugger(in boolean always);
 
-        [handler=Controller] void setBreakpoint(in long callId, in String sourceID, in unsigned long lineNumber, in boolean enabled, in String condition);
+        [handler=Controller] void setBreakpoint(in long callId, in String sourceID, in unsigned int lineNumber, in boolean enabled, in String condition, out boolean success, out unsigned int actualLineNumber);
         [handler=Controller] void removeBreakpoint(in String sourceID, in unsigned long lineNumber);
         [handler=Debug] void activateBreakpoints();
         [handler=Debug] void deactivateBreakpoints();
@@ -121,20 +121,20 @@ module core {
         [handler=Backend] void getProfilerLogLines(in long callId, in long inPosition, out long outPosition, out String log);
 #endif
         [handler=Backend] void setInjectedScriptSource(in String scriptSource);
-        [handler=Backend] void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in String methodName, in String arguments, in boolean async, out Value result, out boolean isException);
+        [handler=Backend, async] void dispatchOnInjectedScript(in long callId, in long injectedScriptId, in String methodName, in String arguments, in boolean async, out Value result, out boolean isException);
         [handler=Controller] void addScriptToEvaluateOnLoad(in String scriptSource);
         [handler=Controller] void removeAllScriptsToEvaluateOnLoad();
 
         [handler=DOM] void getChildNodes(in long callId, in long nodeId);
         [handler=DOM, customResponse=didApplyDomChange] void setAttribute(in long callId, in long elementId, in String name, in String value, out boolean success);
         [handler=DOM, customResponse=didApplyDomChange] void removeAttribute(in long callId, in long elementId, in String name, out boolean success);
-        [handler=DOM] void setTextNodeValue(in long callId, in long nodeId, in String value);
-        [handler=DOM] void getEventListenersForNode(in long callId, in long nodeId, out long nodeId, out Array listenersArray);
+        [handler=DOM, customResponse=didApplyDomChange] void setTextNodeValue(in long callId, in long nodeId, in String value, out boolean success);
+        [handler=DOM] void getEventListenersForNode(in long callId, in long nodeId, out long outNodeId, out Array listenersArray);
         [handler=DOM] void copyNode(in long nodeId);
-        [handler=DOM] void removeNode(in long callId, in long nodeId, out long nodeId);
-        [handler=DOM] void changeTagName(in long callId, in long nodeId, in String newTagName, out long nodeId);
+        [handler=DOM] void removeNode(in long callId, in long nodeId, out long outNodeId);
+        [handler=DOM] void changeTagName(in long callId, in long nodeId, in String newTagName, out long outNodeId);
         [handler=DOM] void getOuterHTML(in long callId, in long nodeId, out String outerHTML);
-        [handler=DOM] void setOuterHTML(in long callId, in long nodeId, in String outerHTML, out long nodeId);
+        [handler=DOM] void setOuterHTML(in long callId, 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();
@@ -149,7 +149,7 @@ module core {
         [handler=DOM] void getAllStyles(in long callId, out Array styles);
         [handler=DOM] void getInlineStyle(in long callId, in long nodeId, out Value style);
         [handler=DOM] void getComputedStyle(in long callId, in long nodeId, out Value style);
-        [handler=DOM] void getStyleSheet(in long callId, in long styleSheetId, out Value styleSheet);
+        [handler=DOM] void getStyleSheet(in long callId, in long styleSheetId, out Object styleSheet);
         [handler=DOM] void getRuleRanges(in long callId, in long styleSheetId, out Value ranges);
         [handler=DOM] void applyStyleText(in long callId, in long styleId, in String styleText, in String propertyName, out boolean success, out Value style, out Array changedProperties);
         [handler=DOM] void setStyleText(in long callId, in long styleId, in String styleText, out boolean success);
@@ -166,7 +166,7 @@ module core {
 #endif
 
         [handler=Backend] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
-        [handler=Controller] void didEvaluateForTestInFrontend(in long callId, in String jsonResult);
+        [handler=Controller] void didEvaluateForTestInFrontend(in long testCallId, in String jsonResult);
 
 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE
         [handler=Backend] void getDatabaseTableNames(in long callId, in long databaseId, out Array tableNames);
diff --git a/WebCore/inspector/InspectorApplicationCacheAgent.cpp b/WebCore/inspector/InspectorApplicationCacheAgent.cpp
index e4392f5..bda442b 100644
--- a/WebCore/inspector/InspectorApplicationCacheAgent.cpp
+++ b/WebCore/inspector/InspectorApplicationCacheAgent.cpp
@@ -61,21 +61,17 @@ void InspectorApplicationCacheAgent::updateNetworkState(bool isNowOnline)
     m_frontend->updateNetworkState(isNowOnline);
 }
 
-void InspectorApplicationCacheAgent::getApplicationCaches(long callId)
+void InspectorApplicationCacheAgent::getApplicationCaches(long, RefPtr<InspectorValue>* applicationCaches)
 {
     DocumentLoader* documentLoader = m_inspectorController->inspectedPage()->mainFrame()->loader()->documentLoader();
-    RefPtr<InspectorValue> applicationCaches;
     if (documentLoader) {
         ApplicationCacheHost* host = documentLoader->applicationCacheHost();
         ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
 
         ApplicationCacheHost::ResourceInfoList resources;
         host->fillResourceList(&resources);
-        applicationCaches = buildObjectForApplicationCache(resources, info);
-    } else
-        applicationCaches = InspectorValue::null();
-
-    m_frontend->didGetApplicationCaches(callId, applicationCaches);
+        *applicationCaches = buildObjectForApplicationCache(resources, info);
+    }
 }
 
 PassRefPtr<InspectorObject> InspectorApplicationCacheAgent::buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList& applicationCacheResources, const ApplicationCacheHost::CacheInfo& applicationCacheInfo)
diff --git a/WebCore/inspector/InspectorApplicationCacheAgent.h b/WebCore/inspector/InspectorApplicationCacheAgent.h
index e03ba4c..dde9c70 100644
--- a/WebCore/inspector/InspectorApplicationCacheAgent.h
+++ b/WebCore/inspector/InspectorApplicationCacheAgent.h
@@ -36,6 +36,7 @@ namespace WebCore {
 class InspectorArray;
 class InspectorController;
 class InspectorObject;
+class InspectorValue;
 class RemoteInspectorFrontend;
 class ResourceResponse;
 
@@ -50,7 +51,7 @@ public:
     void updateNetworkState(bool isNowOnline);
 
     // From Frontend
-    void getApplicationCaches(long callId);
+    void getApplicationCaches(long callId, RefPtr<InspectorValue>* applicationCaches);
 
 private:
     PassRefPtr<InspectorObject> buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList&, const ApplicationCacheHost::CacheInfo&);
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index 48ef602..403f1dd 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -73,28 +73,22 @@ void InspectorBackend::takeHeapSnapshot()
     ScriptProfiler::takeHeapSnapshot();
 }
 
-void InspectorBackend::getProfilerLogLines(long callId, long position)
+void InspectorBackend::getProfilerLogLines(long, long position, long* outPosition, String* data)
 {
     // FIXME: we should make inspector dispatcher pluggable, so that embedders could contribute APIs instead of polluting the core one
     // https://bugs.webkit.org/show_bug.cgi?id=43357
-    if (RemoteInspectorFrontend* frontend = remoteFrontend()) {
-        String data;
-        int outPosition = ScriptProfiler::getProfilerLogLines(position, &data);
-        frontend->didGetProfilerLogLines(callId, outPosition, data);
-    }
+    *outPosition = ScriptProfiler::getProfilerLogLines(position, data);
 }
 #endif
 
 void InspectorBackend::setInjectedScriptSource(const String& source)
 {
-    if (m_inspectorController)
-        m_inspectorController->injectedScriptHost()->setInjectedScriptSource(source);
+     m_inspectorController->injectedScriptHost()->setInjectedScriptSource(source);
 }
 
-void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async)
+void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException)
 {
-    RemoteInspectorFrontend* frontend = remoteFrontend();
-    if (!frontend)
+    if (!remoteFrontend())
         return;
 
     // FIXME: explicitly pass injectedScriptId along with node id to the frontend.
@@ -109,49 +103,35 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript
     if (injectedScript.hasNoValue())
         return;
 
-    RefPtr<InspectorValue> result;
-    bool hadException = false;
-    injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException);
+    injectedScript.dispatch(callId, methodName, arguments, async, result, hadException);
     if (async)
         return;  // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript.
-    frontend->didDispatchOnInjectedScript(callId, result, hadException);
+    remoteFrontend()->didDispatchOnInjectedScript(callId, (*result).get(), *hadException);
 }
 
-void InspectorBackend::clearConsoleMessages(long callId)
+void InspectorBackend::clearConsoleMessages(long)
 {
     m_inspectorController->clearConsoleMessages();
-    if (RemoteInspectorFrontend* frontend = remoteFrontend())
-        frontend->didClearConsoleMessages(callId);
 }
 
 void InspectorBackend::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
 {
-    if (m_inspectorController)
-        m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup);
+    m_inspectorController->injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup);
 }
 
 #if ENABLE(DATABASE)
-void InspectorBackend::getDatabaseTableNames(long callId, long databaseId)
+void InspectorBackend::getDatabaseTableNames(long, long databaseId, RefPtr<InspectorArray>* names)
 {
-    if (RemoteInspectorFrontend* frontend = remoteFrontend()) {
-        RefPtr<InspectorArray> result = InspectorArray::create();
-        Database* database = m_inspectorController->databaseForId(databaseId);
-        if (database) {
-            Vector<String> tableNames = database->tableNames();
-            unsigned length = tableNames.size();
-            for (unsigned i = 0; i < length; ++i)
-                result->pushString(tableNames[i]);
-        }
-        frontend->didGetDatabaseTableNames(callId, result);
+    Database* database = m_inspectorController->databaseForId(databaseId);
+    if (database) {
+        Vector<String> tableNames = database->tableNames();
+        unsigned length = tableNames.size();
+        for (unsigned i = 0; i < length; ++i)
+            (*names)->pushString(tableNames[i]);
     }
 }
 #endif
 
-InspectorFrontend* InspectorBackend::inspectorFrontend()
-{
-    return m_inspectorController->m_frontend.get();
-}
-
 RemoteInspectorFrontend* InspectorBackend::remoteFrontend()
 {
     return m_inspectorController->m_remoteFrontend.get();
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index 7f4b500..bff4db0 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -62,23 +62,22 @@ public:
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     void enableDebugger(bool always);
     void takeHeapSnapshot();
-    void getProfilerLogLines(long callId, long position);
+    void getProfilerLogLines(long callId, long position, long* outPosition, String* data);
 #endif
 
     void setInjectedScriptSource(const String& source);
-    void dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async);
+    void dispatchOnInjectedScript(long callId, long injectedScriptId, const String& methodName, const String& arguments, bool async, RefPtr<InspectorValue>* result, bool* hadException);
     void clearConsoleMessages(long callId);
 
     // Generic code called from custom implementations.
     void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup);
 
 #if ENABLE(DATABASE)
-    void getDatabaseTableNames(long callId, long databaseId);
+    void getDatabaseTableNames(long callId, long databaseId, RefPtr<InspectorArray>* names);
 #endif
 
 private:
     InspectorBackend(InspectorController* inspectorController);
-    InspectorFrontend* inspectorFrontend();
     RemoteInspectorFrontend* remoteFrontend();
 
     InspectorController* m_inspectorController;
diff --git a/WebCore/inspector/InspectorCSSStore.cpp b/WebCore/inspector/InspectorCSSStore.cpp
index d098230..16d2508 100644
--- a/WebCore/inspector/InspectorCSSStore.cpp
+++ b/WebCore/inspector/InspectorCSSStore.cpp
@@ -81,7 +81,7 @@ void InspectorCSSStore::removeDocument(Document* doc)
     m_documentNodeToInspectorStyleSheetMap.remove(doc);
 }
 
-CSSStyleSheet* InspectorCSSStore::inspectorStyleSheet(Document* ownerDocument, bool createIfAbsent, long callId)
+CSSStyleSheet* InspectorCSSStore::inspectorStyleSheet(Document* ownerDocument, bool createIfAbsent)
 {
     DocumentToStyleSheetMap::iterator it = m_documentNodeToInspectorStyleSheetMap.find(ownerDocument);
     if (it != m_documentNodeToInspectorStyleSheetMap.end())
@@ -94,16 +94,12 @@ CSSStyleSheet* InspectorCSSStore::inspectorStyleSheet(Document* ownerDocument, b
         styleElement->setAttribute("type", "text/css", ec);
     if (!ec)
         ownerDocument->head()->appendChild(styleElement, ec);
-    if (ec) {
-        m_inspectorController->remoteInspectorFrontend()->didAddRule(callId, InspectorValue::null(), false);
+    if (ec)
         return 0;
-    }
     StyleSheetList* styleSheets = ownerDocument->styleSheets();
     StyleSheet* styleSheet = styleSheets->item(styleSheets->length() - 1);
-    if (!styleSheet->isCSSStyleSheet()) {
-        m_inspectorController->remoteInspectorFrontend()->didAddRule(callId, InspectorValue::null(), false);
+    if (!styleSheet->isCSSStyleSheet())
         return 0;
-    }
     CSSStyleSheet* inspectorStyleSheet = static_cast<CSSStyleSheet*>(styleSheet);
     m_documentNodeToInspectorStyleSheetMap.set(ownerDocument, inspectorStyleSheet);
     return inspectorStyleSheet;
diff --git a/WebCore/inspector/InspectorCSSStore.h b/WebCore/inspector/InspectorCSSStore.h
index 4f7df00..5691201 100644
--- a/WebCore/inspector/InspectorCSSStore.h
+++ b/WebCore/inspector/InspectorCSSStore.h
@@ -71,7 +71,7 @@ public:
     CSSStyleSheet* styleSheetForId(long styleSheetId);
     CSSStyleRule* ruleForId(long styleRuleId);
     DisabledStyleDeclaration* disabledStyleForId(long styleId, bool createIfAbsent);
-    CSSStyleSheet* inspectorStyleSheet(Document* ownerDocument, bool createIfAbsent, long callId);
+    CSSStyleSheet* inspectorStyleSheet(Document* ownerDocument, bool createIfAbsent);
     void removeDocument(Document*);
 
     long bindRule(CSSStyleRule* rule);
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 566fe10..b8d7bdf 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -186,7 +186,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client)
     , m_resourceTrackingEnabled(false)
     , m_settingsLoaded(false)
     , m_inspectorBackend(InspectorBackend::create(this))
-    , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(m_inspectorBackend.get()))
+    , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(this))
     , m_injectedScriptHost(InjectedScriptHost::create(this))
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     , m_debuggerEnabled(false)
@@ -1299,11 +1299,8 @@ void InspectorController::didOpenDatabase(PassRefPtr<Database> database, const S
 }
 #endif
 
-void InspectorController::getCookies(long callId)
+void InspectorController::getCookies(long, RefPtr<InspectorArray>* cookies, WebCore::String* cookiesString)
 {
-    if (!m_remoteFrontend)
-        return;
-
     // If we can get raw cookies.
     ListHashSet<Cookie> rawCookiesList;
 
@@ -1337,15 +1334,11 @@ void InspectorController::getCookies(long callId)
         }
     }
 
-    RefPtr<InspectorArray> cookies;
-    String cookiesString;
     if (rawCookiesImplemented)
-        cookies = buildArrayForCookies(rawCookiesList);
+        *cookies = buildArrayForCookies(rawCookiesList);
     else {
-        cookies = InspectorArray::create();
-        cookiesString = stringCookiesList;
+        *cookiesString = stringCookiesList;
     }
-    m_remoteFrontend->didGetCookies(callId, cookies, cookiesString);
 }
 
 PassRefPtr<InspectorArray> InspectorController::buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
@@ -1427,12 +1420,8 @@ void InspectorController::selectDOMStorage(Storage* storage)
         m_remoteFrontend->selectDOMStorage(storageResourceId);
 }
 
-void InspectorController::getDOMStorageEntries(long callId, long storageId)
+void InspectorController::getDOMStorageEntries(long, long storageId, RefPtr<InspectorArray>* entries)
 {
-    if (!m_remoteFrontend)
-        return;
-
-    RefPtr<InspectorArray> jsonArray = InspectorArray::create();
     InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
     if (storageResource) {
         storageResource->startReportingChangesToFrontend();
@@ -1443,39 +1432,28 @@ void InspectorController::getDOMStorageEntries(long callId, long storageId)
             RefPtr<InspectorArray> entry = InspectorArray::create();
             entry->pushString(name);
             entry->pushString(value);
-            jsonArray->push(entry);
+            (*entries)->push(entry);
         }
     }
-    m_remoteFrontend->didGetDOMStorageEntries(callId, jsonArray);
 }
 
-void InspectorController::setDOMStorageItem(long callId, long storageId, const String& key, const String& value)
+void InspectorController::setDOMStorageItem(long, long storageId, const String& key, const String& value, bool* success)
 {
-    if (!m_remoteFrontend)
-        return;
-
-    bool success = false;
     InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
     if (storageResource) {
         ExceptionCode exception = 0;
         storageResource->domStorage()->setItem(key, value, exception);
-        success = !exception;
+        *success = !exception;
     }
-    m_remoteFrontend->didSetDOMStorageItem(callId, success);
 }
 
-void InspectorController::removeDOMStorageItem(long callId, long storageId, const String& key)
+void InspectorController::removeDOMStorageItem(long, long storageId, const String& key, bool* success)
 {
-    if (!m_remoteFrontend)
-        return;
-
-    bool success = false;
     InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
     if (storageResource) {
         storageResource->domStorage()->removeItem(key);
-        success = true;
+        *success = true;
     }
-    m_remoteFrontend->didRemoveDOMStorageItem(callId, success);
 }
 
 InspectorDOMStorageResource* InspectorController::getDOMStorageResourceForId(long storageId)
@@ -1537,26 +1515,19 @@ void InspectorController::clearProfiles()
     m_nextUserInitiatedProfileNumber = 1;
 }
 
-void InspectorController::getProfileHeaders(long callId)
+void InspectorController::getProfileHeaders(long, RefPtr<InspectorArray>* headers)
 {
-    if (!m_remoteFrontend)
-        return;
-    RefPtr<InspectorArray> result = InspectorArray::create();
     ProfilesMap::iterator profilesEnd = m_profiles.end();
     for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it)
-        result->push(createProfileHeader(*it->second));
-    m_remoteFrontend->didGetProfileHeaders(callId, result);
+        (*headers)->push(createProfileHeader(*it->second));
 }
 
-void InspectorController::getProfile(long callId, unsigned uid)
+void InspectorController::getProfile(long, unsigned uid, RefPtr<InspectorObject>* profileObject)
 {
-    if (!m_frontend)
-        return;
     ProfilesMap::iterator it = m_profiles.find(uid);
     if (it != m_profiles.end()) {
-        RefPtr<InspectorObject> profileObject = createProfileHeader(*it->second);
-        profileObject->set("head", it->second->buildInspectorObjectForHead());
-        m_remoteFrontend->didGetProfile(callId, profileObject);
+        *profileObject = createProfileHeader(*it->second);
+        (*profileObject)->set("head", it->second->buildInspectorObjectForHead());
     }
 }
 
@@ -1724,22 +1695,15 @@ void InspectorController::disableDebugger(bool always)
         m_frontend->debuggerWasDisabled();
 }
 
-void InspectorController::editScriptSource(long callId, const String& sourceID, const String& newContent)
+void InspectorController::editScriptSource(long, const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames)
 {
-    String result;
-    bool success = ScriptDebugServer::shared().editScriptSource(sourceID, newContent, result);
-    RefPtr<InspectorValue> callFrames;
-    if (success)
-        callFrames = currentCallFrames();
-    m_remoteFrontend->didEditScriptSource(callId, success, result, callFrames.get());
+    if (*success = ScriptDebugServer::shared().editScriptSource(sourceID, newContent, *result))
+        *newCallFrames = currentCallFrames();
 }
 
-void InspectorController::getScriptSource(long callId, const String& sourceID)
+void InspectorController::getScriptSource(long, const String& sourceID, String* scriptSource)
 {
-    if (!m_frontend)
-        return;
-    String scriptSource = m_scriptIDToContent.get(sourceID);
-    m_remoteFrontend->didGetScriptSource(callId, scriptSource);
+    *scriptSource = m_scriptIDToContent.get(sourceID);
 }
 
 void InspectorController::resume()
@@ -1768,27 +1732,25 @@ PassRefPtr<InspectorValue> InspectorController::currentCallFrames()
     return injectedScript.callFrames();
 }
 
-void InspectorController::setBreakpoint(long callId, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition)
+void InspectorController::setBreakpoint(long, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition, bool* success, unsigned int* actualLineNumber)
 {
     ScriptBreakpoint breakpoint(enabled, condition);
-    unsigned actualLineNumber = 0;
-    bool success = ScriptDebugServer::shared().setBreakpoint(sourceID, breakpoint, lineNumber, &actualLineNumber);
-    m_frontend->didSetBreakpoint(callId, success, actualLineNumber);
-    if (!success)
+    *success = ScriptDebugServer::shared().setBreakpoint(sourceID, breakpoint, lineNumber, actualLineNumber);
+    if (!*success)
         return;
 
     String url = m_sourceIDToURL.get(sourceID);
     if (url.isEmpty())
         return;
 
-    String breakpointId = formatBreakpointId(sourceID, actualLineNumber);
-    m_breakpointsMapping.set(breakpointId, actualLineNumber);
+    String breakpointId = formatBreakpointId(sourceID, *actualLineNumber);
+    m_breakpointsMapping.set(breakpointId, *actualLineNumber);
 
     String key = md5Base16(url);
     HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(key);
     if (it == m_stickyBreakpoints.end())
         it = m_stickyBreakpoints.set(key, SourceBreakpoints()).first;
-    it->second.set(actualLineNumber, breakpoint);
+    it->second.set(*actualLineNumber, breakpoint);
     saveBreakpoints();
 }
 
@@ -2167,14 +2129,10 @@ void InspectorController::setInspectorExtensionAPI(const String& source)
     m_inspectorExtensionAPI = source;
 }
 
-void InspectorController::getResourceContent(long callId, unsigned long identifier)
+void InspectorController::getResourceContent(long, unsigned long identifier, String* content)
 {
-    if (!m_remoteFrontend)
-        return;
-
     RefPtr<InspectorResource> resource = m_resources.get(identifier);
-    String content = resource ? resource->sourceString() : String();
-    m_remoteFrontend->didGetResourceContent(callId, content);
+    *content = resource ? resource->sourceString() : String();
 }
 
 void InspectorController::reloadPage()
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index e2b611a..7d1f828 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -120,6 +120,7 @@ public:
 
     InspectorBackend* inspectorBackend() { return m_inspectorBackend.get(); }
     InspectorBackendDispatcher* inspectorBackendDispatcher() { return m_inspectorBackendDispatcher.get(); }
+    InspectorClient* inspectorClient() { return m_client; }
     InjectedScriptHost* injectedScriptHost() { return m_injectedScriptHost.get(); }
 
     void inspectedPageDestroyed();
@@ -190,7 +191,7 @@ public:
     void stopTimelineProfiler();
     InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); }
 
-    void getCookies(long callId);
+    void getCookies(long callId, RefPtr<InspectorArray>* cookies, WebCore::String* cookiesString);
     void deleteCookie(const String& cookieName, const String& domain);
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
@@ -217,9 +218,9 @@ public:
 #if ENABLE(DOM_STORAGE)
     void didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame);
     void selectDOMStorage(Storage* storage);
-    void getDOMStorageEntries(long callId, long storageId);
-    void setDOMStorageItem(long callId, long storageId, const String& key, const String& value);
-    void removeDOMStorageItem(long callId, long storageId, const String& key);
+    void getDOMStorageEntries(long callId, long storageId, RefPtr<InspectorArray>* entries);
+    void setDOMStorageItem(long callId, long storageId, const String& key, const String& value, bool* success);
+    void removeDOMStorageItem(long callId, long storageId, const String& key, bool* success);
 #endif
 
     const ResourcesMap& resources() const { return m_resources; }
@@ -262,8 +263,8 @@ public:
     void disableDebugger(bool always = false);
     bool debuggerEnabled() const { return m_debuggerEnabled; }
 
-    void editScriptSource(long callId, const String& sourceID, const String& newContent);
-    void getScriptSource(long callId, const String& sourceID);
+    void editScriptSource(long callId, const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames);
+    void getScriptSource(long callId, const String& sourceID, String* scriptSource);
 
     void resume();
     void setPauseOnExceptionsState(long pauseState);
@@ -308,7 +309,7 @@ private:
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     PassRefPtr<InspectorValue> currentCallFrames();
 
-    void setBreakpoint(long callId, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition);
+    void setBreakpoint(long callId, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition, bool* success, unsigned int* actualLineNumber);
     void removeBreakpoint(const String& sourceID, unsigned lineNumber);
 
     typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap;
@@ -316,8 +317,8 @@ private:
     void startUserInitiatedProfilingSoon();
     void toggleRecordButton(bool);
     void enableDebuggerFromFrontend(bool always);
-    void getProfileHeaders(long callId);
-    void getProfile(long callId, unsigned uid);
+    void getProfileHeaders(long callId, RefPtr<InspectorArray>* headers);
+    void getProfile(long callId, unsigned uid, RefPtr<InspectorObject>* profileObject);
     PassRefPtr<InspectorObject> createProfileHeader(const ScriptProfile& profile);
 #endif
 #if ENABLE(DATABASE)
@@ -338,7 +339,7 @@ private:
     void addResource(InspectorResource*);
     void removeResource(InspectorResource*);
     InspectorResource* getTrackedResource(unsigned long identifier);
-    void getResourceContent(long callId, unsigned long identifier);
+    void getResourceContent(long callId, unsigned long identifier, String* content);
 
     void pruneResources(ResourcesMap*, DocumentLoader* loaderToKeep = 0);
     void removeAllResources(ResourcesMap* map) { pruneResources(map); }
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index 075944a..04a1cd1 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -384,10 +384,9 @@ Node* InspectorDOMAgent::nodeForId(long id)
     return 0;
 }
 
-void InspectorDOMAgent::getChildNodes(long callId, long nodeId)
+void InspectorDOMAgent::getChildNodes(long, long nodeId)
 {
     pushChildNodesToFrontend(nodeId);
-    m_frontend->didGetChildNodes(callId);
 }
 
 long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush)
@@ -432,72 +431,56 @@ long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush)
     return map->get(nodeToPush);
 }
 
-void InspectorDOMAgent::setAttribute(long callId, long elementId, const String& name, const String& value)
+void InspectorDOMAgent::setAttribute(long, long elementId, const String& name, const String& value, bool* success)
 {
     Node* node = nodeForId(elementId);
     if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
         Element* element = static_cast<Element*>(node);
         ExceptionCode ec = 0;
         element->setAttribute(name, value, ec);
-        m_frontend->didApplyDomChange(callId, ec == 0);
-    } else {
-        m_frontend->didApplyDomChange(callId, false);
+        *success = !ec;
     }
 }
 
-void InspectorDOMAgent::removeAttribute(long callId, long elementId, const String& name)
+void InspectorDOMAgent::removeAttribute(long, long elementId, const String& name, bool* success)
 {
     Node* node = nodeForId(elementId);
     if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
         Element* element = static_cast<Element*>(node);
         ExceptionCode ec = 0;
         element->removeAttribute(name, ec);
-        m_frontend->didApplyDomChange(callId, ec == 0);
-    } else {
-        m_frontend->didApplyDomChange(callId, false);
+        *success = !ec;
     }
 }
 
-void InspectorDOMAgent::removeNode(long callId, long nodeId)
+void InspectorDOMAgent::removeNode(long, long nodeId, long* outNodeId)
 {
     Node* node = nodeForId(nodeId);
-    if (!node) {
-        m_frontend->didRemoveNode(callId, 0);
+    if (!node)
         return;
-    }
 
     Node* parentNode = node->parentNode();
-    if (!parentNode) {
-        m_frontend->didRemoveNode(callId, 0);
+    if (!parentNode)
         return;
-    }
 
     ExceptionCode ec = 0;
     parentNode->removeChild(node, ec);
-    if (ec) {
-        m_frontend->didRemoveNode(callId, 0);
+    if (ec)
         return;
-    }
 
-    m_frontend->didRemoveNode(callId, nodeId);
+    *outNodeId = nodeId;
 }
 
-void InspectorDOMAgent::changeTagName(long callId, long nodeId, const String& tagName)
+void InspectorDOMAgent::changeTagName(long, long nodeId, const String& tagName, long* newId)
 {
     Node* oldNode = nodeForId(nodeId);
-    if (!oldNode || !oldNode->isElementNode()) {
-        m_frontend->didChangeTagName(callId, 0);
+    if (!oldNode || !oldNode->isElementNode())
         return;
-    }
-
-    bool childrenRequested = m_childrenRequested.contains(nodeId);
 
     ExceptionCode ec = 0;
     RefPtr<Element> newElem = oldNode->document()->createElement(tagName, ec);
-    if (ec) {
-        m_frontend->didChangeTagName(callId, 0);
+    if (ec)
         return;
-    }
 
     // Copy over the original node's attributes.
     Element* oldElem = static_cast<Element*>(oldNode);
@@ -515,36 +498,28 @@ void InspectorDOMAgent::changeTagName(long callId, long nodeId, const String& ta
     parent->insertBefore(newElem, oldNode->nextSibling(), ec);
     parent->removeChild(oldNode, ec);
 
-    if (ec) {
-        m_frontend->didChangeTagName(callId, 0);
+    if (ec)
         return;
-    }
 
-    long newId = pushNodePathToFrontend(newElem.get());
-    if (childrenRequested)
-        pushChildNodesToFrontend(newId);
-    m_frontend->didChangeTagName(callId, newId);
+    *newId = pushNodePathToFrontend(newElem.get());
+    if (m_childrenRequested.contains(nodeId))
+        pushChildNodesToFrontend(*newId);
 }
 
-void InspectorDOMAgent::getOuterHTML(long callId, long nodeId)
+void InspectorDOMAgent::getOuterHTML(long, long nodeId, WebCore::String* outerHTML)
 {
     Node* node = nodeForId(nodeId);
-    if (!node || !node->isHTMLElement()) {
-        m_frontend->didGetOuterHTML(callId, "");
+    if (!node || !node->isHTMLElement())
         return;
-    }
 
-    HTMLElement* htmlElement = static_cast<HTMLElement*>(node);
-    m_frontend->didGetOuterHTML(callId, htmlElement->outerHTML());
+    *outerHTML = static_cast<HTMLElement*>(node)->outerHTML();
 }
 
-void InspectorDOMAgent::setOuterHTML(long callId, long nodeId, const String& outerHTML)
+void InspectorDOMAgent::setOuterHTML(long, long nodeId, const String& outerHTML, long* newId)
 {
     Node* node = nodeForId(nodeId);
-    if (!node || !node->isHTMLElement()) {
-        m_frontend->didSetOuterHTML(callId, 0);
+    if (!node || !node->isHTMLElement())
         return;
-    }
 
     bool childrenRequested = m_childrenRequested.contains(nodeId);
     Node* previousSibling = node->previousSibling();
@@ -554,41 +529,35 @@ void InspectorDOMAgent::setOuterHTML(long callId, long nodeId, const String& out
     ExceptionCode ec = 0;
     htmlElement->setOuterHTML(outerHTML, ec);
     if (ec)
-        m_frontend->didSetOuterHTML(callId, 0);
+        return;
 
     Node* newNode = previousSibling ? previousSibling->nextSibling() : parentNode->firstChild();
 
-    long newId = pushNodePathToFrontend(newNode);
+    *newId = pushNodePathToFrontend(newNode);
     if (childrenRequested)
-        pushChildNodesToFrontend(newId);
-
-    m_frontend->didSetOuterHTML(callId, newId);
+        pushChildNodesToFrontend(*newId);
 }
 
-void InspectorDOMAgent::setTextNodeValue(long callId, long nodeId, const String& value)
+void InspectorDOMAgent::setTextNodeValue(long, long nodeId, const String& value, bool* success)
 {
     Node* node = nodeForId(nodeId);
     if (node && (node->nodeType() == Node::TEXT_NODE)) {
         Text* text_node = static_cast<Text*>(node);
         ExceptionCode ec = 0;
         text_node->replaceWholeText(value, ec);
-        m_frontend->didApplyDomChange(callId, ec == 0);
-    } else {
-        m_frontend->didApplyDomChange(callId, false);
+        *success = !ec;
     }
 }
 
-void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId)
+void InspectorDOMAgent::getEventListenersForNode(long, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray)
 {
     Node* node = nodeForId(nodeId);
-    RefPtr<InspectorArray> listenersArray = InspectorArray::create();
+    *outNodeId = nodeId;
     EventTargetData* d;
 
     // Quick break if a null node or no listeners at all
-    if (!node || !(d = node->eventTargetData())) {
-        m_frontend->didGetEventListenersForNode(callId, nodeId, listenersArray.release());
+    if (!node || !(d = node->eventTargetData()))
         return;
-    }
 
     // Get the list of event types this Node is concerned with
     Vector<AtomicString> eventTypes;
@@ -599,10 +568,8 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId)
 
     // Quick break if no useful listeners
     size_t eventTypesLength = eventTypes.size();
-    if (eventTypesLength == 0) {
-        m_frontend->didGetEventListenersForNode(callId, nodeId, listenersArray.release());
+    if (!eventTypesLength)
         return;
-    }
 
     // The Node's Event Ancestors (not including self)
     Vector<RefPtr<ContainerNode> > ancestors;
@@ -633,7 +600,7 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId)
         for (size_t j = 0; j < vector.size(); ++j) {
             const RegisteredEventListener& listener = vector[j];
             if (listener.useCapture)
-                listenersArray->push(buildObjectForEventListener(listener, info.eventType, info.node));
+                (*listenersArray)->push(buildObjectForEventListener(listener, info.eventType, info.node));
         }
     }
 
@@ -644,11 +611,9 @@ void InspectorDOMAgent::getEventListenersForNode(long callId, long nodeId)
         for (size_t j = 0; j < vector.size(); ++j) {
             const RegisteredEventListener& listener = vector[j];
             if (!listener.useCapture)
-                listenersArray->push(buildObjectForEventListener(listener, info.eventType, info.node));
+                (*listenersArray)->push(buildObjectForEventListener(listener, info.eventType, info.node));
         }
     }
-
-    m_frontend->didGetEventListenersForNode(callId, nodeId, listenersArray.release());
 }
 
 void InspectorDOMAgent::addInspectedNode(long nodeId)
@@ -1006,19 +971,15 @@ void InspectorDOMAgent::didModifyDOMAttr(Element* element)
     m_frontend->attributesUpdated(id, buildArrayForElementAttributes(element));
 }
 
-void InspectorDOMAgent::getStyles(long callId, long nodeId, bool authorOnly)
+void InspectorDOMAgent::getStyles(long, long nodeId, bool authorOnly, RefPtr<InspectorValue>* styles)
 {
     Node* node = nodeForId(nodeId);
-    if (!node || node->nodeType() != Node::ELEMENT_NODE) {
-        m_frontend->didGetStyles(callId, InspectorValue::null());
+    if (!node || node->nodeType() != Node::ELEMENT_NODE)
         return;
-    }
 
     DOMWindow* defaultView = node->ownerDocument()->defaultView();
-    if (!defaultView) {
-        m_frontend->didGetStyles(callId, InspectorValue::null());
+    if (!defaultView)
         return;
-    }
 
     Element* element = static_cast<Element*>(node);
     RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(node, true); // Support the viewing of :visited information in computed style.
@@ -1050,41 +1011,35 @@ void InspectorDOMAgent::getStyles(long callId, long nodeId, bool authorOnly)
         parentElement = parentElement->parentElement();
         currentStyle = parentStyle;
     }
-    m_frontend->didGetStyles(callId, result.release());
+    *styles = result.release();
 }
 
-void InspectorDOMAgent::getAllStyles(long callId)
+void InspectorDOMAgent::getAllStyles(long, RefPtr<InspectorArray>* styles)
 {
-    RefPtr<InspectorArray> result = InspectorArray::create();
     for (ListHashSet<RefPtr<Document> >::iterator it = m_documents.begin(); it != m_documents.end(); ++it) {
         StyleSheetList* list = (*it)->styleSheets();
         for (unsigned i = 0; i < list->length(); ++i) {
             StyleSheet* styleSheet = list->item(i);
             if (styleSheet->isCSSStyleSheet())
-                result->push(buildObjectForStyleSheet((*it).get(), static_cast<CSSStyleSheet*>(styleSheet)));
+                (*styles)->push(buildObjectForStyleSheet((*it).get(), static_cast<CSSStyleSheet*>(styleSheet)));
         }
     }
-    m_frontend->didGetAllStyles(callId, result.release());
 }
 
-void InspectorDOMAgent::getStyleSheet(long callId, long styleSheetId)
+void InspectorDOMAgent::getStyleSheet(long, long styleSheetId, RefPtr<InspectorObject>* styleSheetObject)
 {
     CSSStyleSheet* styleSheet = cssStore()->styleSheetForId(styleSheetId);
     if (styleSheet && styleSheet->doc())
-        m_frontend->didGetStyleSheet(callId, buildObjectForStyleSheet(styleSheet->doc(), styleSheet));
-    else
-        m_frontend->didGetStyleSheet(callId, InspectorObject::create());
+        *styleSheetObject = buildObjectForStyleSheet(styleSheet->doc(), styleSheet);
 }
 
-void InspectorDOMAgent::getRuleRanges(long callId, long styleSheetId)
+void InspectorDOMAgent::getRuleRanges(long, long styleSheetId, RefPtr<InspectorValue>* ruleRange)
 {
     CSSStyleSheet* styleSheet = cssStore()->styleSheetForId(styleSheetId);
     if (styleSheet && styleSheet->doc()) {
         HashMap<long, SourceRange> ruleRanges = cssStore()->getRuleRanges(styleSheet);
-        if (!ruleRanges.size()) {
-            m_frontend->didGetStyleSheet(callId, InspectorObject::create());
+        if (!ruleRanges.size())
             return;
-        }
         RefPtr<InspectorObject> result = InspectorObject::create();
         for (HashMap<long, SourceRange>::iterator it = ruleRanges.begin(); it != ruleRanges.end(); ++it) {
             if (it->second.second) {
@@ -1096,39 +1051,30 @@ void InspectorDOMAgent::getRuleRanges(long callId, long styleSheetId)
                 bodyRange->setNumber("end", it->second.second);
             }
         }
-        m_frontend->didGetRuleRanges(callId, result);
-    } else
-        m_frontend->didGetRuleRanges(callId, InspectorValue::null());
+        *ruleRange = result.release();
+    }
 }
 
-void InspectorDOMAgent::getInlineStyle(long callId, long nodeId)
+void InspectorDOMAgent::getInlineStyle(long, long nodeId, RefPtr<InspectorValue>* style)
 {
     Node* node = nodeForId(nodeId);
-    if (!node || node->nodeType() != Node::ELEMENT_NODE) {
-        m_frontend->didGetInlineStyle(callId, InspectorValue::null());
+    if (!node || node->nodeType() != Node::ELEMENT_NODE)
         return;
-    }
-    Element* element = static_cast<Element*>(node);
-    m_frontend->didGetInlineStyle(callId, buildObjectForStyle(element->style(), true));
+    *style = buildObjectForStyle(static_cast<Element*>(node)->style(), true);
 }
 
-void InspectorDOMAgent::getComputedStyle(long callId, long nodeId)
+void InspectorDOMAgent::getComputedStyle(long, long nodeId, RefPtr<InspectorValue>* style)
 {
     Node* node = nodeForId(nodeId);
-    if (!node || node->nodeType() != Node::ELEMENT_NODE) {
-        m_frontend->didGetComputedStyle(callId, InspectorValue::null());
+    if (!node || node->nodeType() != Node::ELEMENT_NODE)
         return;
-    }
 
     DOMWindow* defaultView = node->ownerDocument()->defaultView();
-    if (!defaultView) {
-        m_frontend->didGetComputedStyle(callId, InspectorValue::null());
+    if (!defaultView)
         return;
-    }
 
     Element* element = static_cast<Element*>(node);
-    RefPtr<CSSStyleDeclaration> computedStyle = defaultView->getComputedStyle(element, "");
-    m_frontend->didGetComputedStyle(callId, buildObjectForStyle(computedStyle.get(), false));
+    *style = buildObjectForStyle(defaultView->getComputedStyle(element, "").get(), false);
 }
 
 PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForAttributeStyles(Element* element)
@@ -1174,13 +1120,11 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForPseudoElements(Elemen
     return result.release();
 }
 
-void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String& styleText, const String& propertyName)
+void InspectorDOMAgent::applyStyleText(long, long styleId, const String& styleText, const String& propertyName, bool* success, RefPtr<InspectorValue>* styleObject, RefPtr<InspectorArray>* changedPropertiesArray)
 {
     CSSStyleDeclaration* style = cssStore()->styleForId(styleId);
-    if (!style) {
-        m_frontend->didApplyStyleText(callId, false, InspectorValue::null(), InspectorArray::create());
+    if (!style)
         return;
-    }
 
     // Remove disabled property entry for property with given name.
     DisabledStyleDeclaration* disabledStyle = cssStore()->disabledStyleForId(styleId, false);
@@ -1207,24 +1151,19 @@ void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String&
         if (!ec)
             style->removeProperty(propertyName, ec);
 
-        if (ec) {
-            m_frontend->didApplyStyleText(callId, false, InspectorValue::null(), InspectorArray::create());
+        if (ec)
             return;
-        }
     }
 
     // Notify caller that the property was successfully deleted.
     if (!styleTextLength) {
-        RefPtr<InspectorArray> changedProperties = InspectorArray::create();
-        changedProperties->pushString(propertyName);
-        m_frontend->didApplyStyleText(callId, true, InspectorValue::null(), changedProperties.release());
+        (*changedPropertiesArray)->pushString(propertyName);
+        *success = true;
         return;
     }
 
-    if (!tempStyle->length()) {
-        m_frontend->didApplyStyleText(callId, false, InspectorValue::null(), InspectorArray::create());
+    if (!tempStyle->length())
         return;
-    }
 
     // Iterate of the properties on the test element's style declaration and
     // add them to the real style declaration. We take care to move shorthands.
@@ -1258,41 +1197,37 @@ void InspectorDOMAgent::applyStyleText(long callId, long styleId, const String&
             disabledStyle->remove(name);
         changedProperties.append(name);
     }
-    m_frontend->didApplyStyleText(callId, true, buildObjectForStyle(style, true), toArray(changedProperties));
+    *success = true;
+    *styleObject = buildObjectForStyle(style, true);
+    *changedPropertiesArray = toArray(changedProperties);
 }
 
-void InspectorDOMAgent::setStyleText(long callId, long styleId, const String& cssText)
+void InspectorDOMAgent::setStyleText(long, long styleId, const String& cssText, bool* success)
 {
     CSSStyleDeclaration* style = cssStore()->styleForId(styleId);
-    if (!style) {
-        m_frontend->didSetStyleText(callId, false);
+    if (!style)
         return;
-    }
     ExceptionCode ec = 0;
     style->setCssText(cssText, ec);
-    m_frontend->didSetStyleText(callId, !ec);
+    *success = !ec;
 }
 
-void InspectorDOMAgent::setStyleProperty(long callId, long styleId, const String& name, const String& value)
+void InspectorDOMAgent::setStyleProperty(long, long styleId, const String& name, const String& value, bool* success)
 {
     CSSStyleDeclaration* style = cssStore()->styleForId(styleId);
-    if (!style) {
-        m_frontend->didSetStyleProperty(callId, false);
+    if (!style)
         return;
-    }
 
     ExceptionCode ec = 0;
     style->setProperty(name, value, ec);
-    m_frontend->didSetStyleProperty(callId, !ec);
+    *success = !ec;
 }
 
-void InspectorDOMAgent::toggleStyleEnabled(long callId, long styleId, const String& propertyName, bool disabled)
+void InspectorDOMAgent::toggleStyleEnabled(long, long styleId, const String& propertyName, bool disabled, RefPtr<InspectorValue>* styleObject)
 {
     CSSStyleDeclaration* style = cssStore()->styleForId(styleId);
-    if (!style) {
-        m_frontend->didToggleStyleEnabled(callId, InspectorValue::null());
+    if (!style)
         return;
-    }
 
     DisabledStyleDeclaration* disabledStyle = cssStore()->disabledStyleForId(styleId, true);
 
@@ -1308,30 +1243,24 @@ void InspectorDOMAgent::toggleStyleEnabled(long callId, long styleId, const Stri
         if (!ec)
             disabledStyle->remove(propertyName);
     }
-    if (ec) {
-        m_frontend->didToggleStyleEnabled(callId, InspectorValue::null());
+    if (ec)
         return;
-    }
-    m_frontend->didToggleStyleEnabled(callId, buildObjectForStyle(style, true));
+    *styleObject = buildObjectForStyle(style, true);
 }
 
-void InspectorDOMAgent::setRuleSelector(long callId, long ruleId, const String& selector, long selectedNodeId)
+void InspectorDOMAgent::setRuleSelector(long, long ruleId, const String& selector, long selectedNodeId, RefPtr<InspectorValue>* ruleObject, bool* selectorAffectsNode)
 {
     CSSStyleRule* rule = cssStore()->ruleForId(ruleId);
-    if (!rule) {
-        m_frontend->didSetRuleSelector(callId, InspectorValue::null(), false);
+    if (!rule)
         return;
-    }
 
     Node* node = nodeForId(selectedNodeId);
 
     CSSStyleSheet* styleSheet = rule->parentStyleSheet();
     ExceptionCode ec = 0;
     styleSheet->addRule(selector, rule->style()->cssText(), ec);
-    if (ec) {
-        m_frontend->didSetRuleSelector(callId, InspectorValue::null(), false);
+    if (ec)
         return;
-    }
 
     CSSStyleRule* newRule = static_cast<CSSStyleRule*>(styleSheet->item(styleSheet->length() - 1));
     for (unsigned i = 0; i < styleSheet->length(); ++i) {
@@ -1341,35 +1270,31 @@ void InspectorDOMAgent::setRuleSelector(long callId, long ruleId, const String&
         }
     }
 
-    if (ec) {
-        m_frontend->didSetRuleSelector(callId, InspectorValue::null(), false);
+    if (ec)
         return;
-    }
 
-    m_frontend->didSetRuleSelector(callId, buildObjectForRule(node->ownerDocument(), newRule), ruleAffectsNode(newRule, node));
+    *selectorAffectsNode = ruleAffectsNode(newRule, node);
+    *ruleObject = buildObjectForRule(node->ownerDocument(), newRule);
 }
 
-void InspectorDOMAgent::addRule(long callId, const String& selector, long selectedNodeId)
+void InspectorDOMAgent::addRule(long, const String& selector, long selectedNodeId, RefPtr<InspectorValue>* ruleObject, bool* selectorAffectsNode)
 {
     Node* node = nodeForId(selectedNodeId);
-    if (!node) {
-        m_frontend->didAddRule(callId, InspectorValue::null(), false);
+    if (!node)
         return;
-    }
 
-    CSSStyleSheet* styleSheet = cssStore()->inspectorStyleSheet(node->ownerDocument(), true, callId);
+    CSSStyleSheet* styleSheet = cssStore()->inspectorStyleSheet(node->ownerDocument(), true);
     if (!styleSheet)
         return; // could not add a stylesheet to the ownerDocument
 
     ExceptionCode ec = 0;
     styleSheet->addRule(selector, "", ec);
-    if (ec) {
-        m_frontend->didAddRule(callId, InspectorValue::null(), false);
+    if (ec)
         return;
-    }
 
     CSSStyleRule* newRule = static_cast<CSSStyleRule*>(styleSheet->item(styleSheet->length() - 1));
-    m_frontend->didAddRule(callId, buildObjectForRule(node->ownerDocument(), newRule), ruleAffectsNode(newRule, node));
+    *selectorAffectsNode = ruleAffectsNode(newRule, node);
+    *ruleObject = buildObjectForRule(node->ownerDocument(), newRule);
 }
 
 PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForStyle(CSSStyleDeclaration* style, bool bind)
@@ -1471,7 +1396,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForRule(Document* owne
     bool isUser = parentStyleSheet && parentStyleSheet->ownerNode() && parentStyleSheet->ownerNode()->nodeName() == "#document";
     result->setBool("isUserAgent", isUserAgent);
     result->setBool("isUser", isUser);
-    result->setBool("isViaInspector", rule->parentStyleSheet() == cssStore()->inspectorStyleSheet(ownerDocument, false, -1));
+    result->setBool("isViaInspector", rule->parentStyleSheet() == cssStore()->inspectorStyleSheet(ownerDocument, false));
 
     // Bind editable scripts only.
     bool bind = !isUserAgent && !isUser;
@@ -1642,17 +1567,10 @@ void InspectorDOMAgent::copyNode(long nodeId)
     Pasteboard::generalPasteboard()->writePlainText(markup);
 }
 
-void InspectorDOMAgent::pushNodeByPathToFrontend(long callId, const String& path)
+void InspectorDOMAgent::pushNodeByPathToFrontend(long, const String& path, long* nodeId)
 {
-    if (!m_frontend)
-        return;
-
-    long id = 0;
-    Node* node = nodeForPath(path);
-    if (node)
-        id = pushNodePathToFrontend(node);
-
-    m_frontend->didPushNodeByPathToFrontend(callId, id);
+    if (Node* node = nodeForPath(path))
+        *nodeId = pushNodePathToFrontend(node);
 }
 
 } // namespace WebCore
diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h
index 38b7034..9fcf95d 100644
--- a/WebCore/inspector/InspectorDOMAgent.h
+++ b/WebCore/inspector/InspectorDOMAgent.h
@@ -101,31 +101,31 @@ namespace WebCore {
 
         // Methods called from the frontend for DOM nodes inspection.
         void getChildNodes(long callId, long nodeId);
-        void setAttribute(long callId, long elementId, const String& name, const String& value);
-        void removeAttribute(long callId, long elementId, const String& name);
-        void removeNode(long callId, long nodeId);
-        void changeTagName(long callId, long nodeId, const String& tagName);
-        void getOuterHTML(long callId, long nodeId);
-        void setOuterHTML(long callId, long nodeId, const String& outerHTML);
-        void setTextNodeValue(long callId, long nodeId, const String& value);
-        void getEventListenersForNode(long callId, long nodeId);
+        void setAttribute(long callId, long elementId, const String& name, const String& value, bool* success);
+        void removeAttribute(long callId, long elementId, const String& name, bool* success);
+        void removeNode(long callId, long nodeId, long* outNodeId);
+        void changeTagName(long callId, long nodeId, const String& tagName, long* newId);
+        void getOuterHTML(long callId, long nodeId, WebCore::String* outerHTML);
+        void setOuterHTML(long callId, long nodeId, const String& outerHTML, long* newId);
+        void setTextNodeValue(long callId, long nodeId, const String& value, bool* success);
+        void getEventListenersForNode(long callId, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray);
         void addInspectedNode(long nodeId);
         void performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously);
         void searchCanceled();
 
         // Methods called from the frontend for CSS styles inspection.
-        void getStyles(long callId, long nodeId, bool authorOnly);
-        void getAllStyles(long callId);
-        void getInlineStyle(long callId, long nodeId);
-        void getComputedStyle(long callId, long nodeId);
-        void getStyleSheet(long callId, long styleSheetId);
-        void getRuleRanges(long callId, long styleSheetId);
-        void applyStyleText(long callId, long styleId, const String& styleText, const String& propertyName);
-        void setStyleText(long callId, long styleId, const String& cssText);
-        void setStyleProperty(long callId, long styleId, const String& name, const String& value);
-        void toggleStyleEnabled(long callId, long styleId, const String& propertyName, bool disabled);
-        void setRuleSelector(long callId, long ruleId, const String& selector, long selectedNodeId);
-        void addRule(long callId, const String& selector, long selectedNodeId);
+        void getStyles(long callId, long nodeId, bool authorOnly, RefPtr<InspectorValue>* styles);
+        void getAllStyles(long callId, RefPtr<InspectorArray>* styles);
+        void getInlineStyle(long callId, long nodeId, RefPtr<InspectorValue>* styles);
+        void getComputedStyle(long callId, long nodeId, RefPtr<InspectorValue>* styles);
+        void getStyleSheet(long callId, long styleSheetId, RefPtr<InspectorObject>* styleSheetObject);
+        void getRuleRanges(long callId, long styleSheetId, RefPtr<InspectorValue>* ruleRange);
+        void applyStyleText(long callId, long styleId, const String& styleText, const String& propertyName, bool* success, RefPtr<InspectorValue>* styleObject, RefPtr<InspectorArray>* changedProperties);
+        void setStyleText(long callId, long styleId, const String& cssText, bool* success);
+        void setStyleProperty(long callId, long styleId, const String& name, const String& value, bool* success);
+        void toggleStyleEnabled(long callId, long styleId, const String& propertyName, bool disabled, RefPtr<InspectorValue>* styleObject);
+        void setRuleSelector(long callId, long ruleId, const String& selector, long selectedNodeId, RefPtr<InspectorValue>* ruleObject, bool* selectorAffectsNode);
+        void addRule(long callId, const String& selector, long selectedNodeId, RefPtr<InspectorValue>* ruleObject, bool* selectorAffectsNode);
 
         // Methods called from the InspectorController.
         void setDocument(Document* document);
@@ -138,7 +138,7 @@ namespace WebCore {
         Node* nodeForId(long nodeId);
         long pushNodePathToFrontend(Node* node);
         void pushChildNodesToFrontend(long nodeId);
-        void pushNodeByPathToFrontend(long callId, const String& path);
+        void pushNodeByPathToFrontend(long callId, const String& path, long* nodeId);
         long inspectedNode(unsigned long num);
         void copyNode(long nodeId);
 
diff --git a/WebCore/inspector/InspectorValues.cpp b/WebCore/inspector/InspectorValues.cpp
index d488b50..dad84ac 100644
--- a/WebCore/inspector/InspectorValues.cpp
+++ b/WebCore/inspector/InspectorValues.cpp
@@ -494,6 +494,11 @@ bool InspectorValue::asNumber(unsigned long*) const
     return false;
 }
 
+bool InspectorValue::asNumber(unsigned int*) const
+{
+    return false;
+}
+
 bool InspectorValue::asString(String*) const
 {
     return false;
@@ -566,6 +571,13 @@ bool InspectorBasicValue::asNumber(unsigned long* output) const
     return true;
 }
 
+bool InspectorBasicValue::asNumber(unsigned int* output) const
+{
+    if (type() != TypeDouble)
+        return false;
+    *output = static_cast<unsigned int>(m_doubleValue);
+    return true;
+}
 
 void InspectorBasicValue::writeJSON(Vector<UChar>* output) const
 {
diff --git a/WebCore/inspector/InspectorValues.h b/WebCore/inspector/InspectorValues.h
index 940bab9..642f093 100644
--- a/WebCore/inspector/InspectorValues.h
+++ b/WebCore/inspector/InspectorValues.h
@@ -71,6 +71,7 @@ public:
     virtual bool asNumber(double* output) const;
     virtual bool asNumber(long* output) const;
     virtual bool asNumber(unsigned long* output) const;
+    virtual bool asNumber(unsigned int* output) const;
     virtual bool asString(String* output) const;
     virtual PassRefPtr<InspectorObject> asObject();
     virtual PassRefPtr<InspectorArray> asArray();
@@ -109,6 +110,7 @@ public:
     virtual bool asNumber(double* output) const;
     virtual bool asNumber(long* output) const;
     virtual bool asNumber(unsigned long* output) const;
+    virtual bool asNumber(unsigned int* output) const;
 
     virtual void writeJSON(Vector<UChar>* output) const;
 
diff --git a/WebCore/inspector/front-end/Callback.js b/WebCore/inspector/front-end/Callback.js
index 8ae7f95..c8ae03e 100644
--- a/WebCore/inspector/front-end/Callback.js
+++ b/WebCore/inspector/front-end/Callback.js
@@ -48,9 +48,15 @@ WebInspector.Callback.prototype = {
         var callback = this._callbacks[callbackId];
         callback.apply(null, args);
         delete this._callbacks[callbackId];
+    },
+
+    removeCallbackEntry: function(callbackId)
+    {
+        delete this._callbacks[callbackId];
     }
 }
 
 WebInspector.Callback._INSTANCE = new WebInspector.Callback();
 WebInspector.Callback.wrap = WebInspector.Callback._INSTANCE.wrap.bind(WebInspector.Callback._INSTANCE);
 WebInspector.Callback.processCallback = WebInspector.Callback._INSTANCE.processCallback.bind(WebInspector.Callback._INSTANCE);
+WebInspector.Callback.removeCallbackEntry = WebInspector.Callback._INSTANCE.removeCallbackEntry.bind(WebInspector.Callback._INSTANCE);
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index 09a84f7..6713ddc 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -179,12 +179,12 @@ WebInspector.ElementsPanel.prototype = {
         this.recentlyModifiedNodes = [];
 
         delete this.currentQuery;
-        this.searchCanceled();
     },
 
     setDocument: function(inspectedRootDocument)
     {
         this.reset();
+        this.searchCanceled();
 
         if (!inspectedRootDocument)
             return;
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 9d41766..8ebe23b 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -586,6 +586,11 @@ WebInspector.dispatchMessageFromBackend = function(arguments)
     WebInspector.dispatch.apply(this, arguments);
 }
 
+WebInspector.reportProtocolError = function(callId, methodName, errorText)
+{
+    WebInspector.log("InspectorBackend." + methodName + " failed with error text: '" + errorText + "'");
+    WebInspector.Callback.removeCallbackEntry(callId);
+}
 
 WebInspector.windowResize = function(event)
 {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list