[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

pfeldman at chromium.org pfeldman at chromium.org
Sun Feb 20 23:14:17 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 654a83d3318bde00dbb7112c8604627c8a191afc
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 19 09:00:58 2011 +0000

    2011-01-18  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
            https://bugs.webkit.org/show_bug.cgi?id=52652
    
            Calls served by the InjectedScript should be first class protocol
            citizens, not dispatched via single protocol message.
    
            * http/tests/inspector/extensions-test.js:
            (initialize_ExtensionsTest.InspectorTest.runExtensionTests):
            * http/tests/inspector/inspector-test2.js:
            (initialize_InspectorTest.InspectorTest.evaluateInPage):
            * http/tests/inspector/resource-har-conversion.html:
            * inspector/console-command-clear.html:
            * inspector/console-dir-global.html:
    2011-01-18  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
            https://bugs.webkit.org/show_bug.cgi?id=52652
    
            Calls served by the InjectedScript should be first class protocol
            citizens, not dispatched via single protocol message.
    
            * WebCore.gypi:
            * WebCore.vcproj/WebCore.vcproj:
            * inspector/CodeGeneratorInspector.pm:
            * inspector/InjectedScript.cpp:
            (WebCore::InjectedScript::evaluate):
            (WebCore::InjectedScript::evaluateInCallFrame):
            (WebCore::InjectedScript::evaluateOnSelf):
            (WebCore::InjectedScript::getCompletions):
            (WebCore::InjectedScript::getProperties):
            (WebCore::InjectedScript::pushNodeToFrontend):
            (WebCore::InjectedScript::resolveNode):
            (WebCore::InjectedScript::getNodeProperties):
            (WebCore::InjectedScript::getNodePrototypes):
            (WebCore::InjectedScript::setPropertyValue):
            (WebCore::InjectedScript::makeCall):
            * inspector/InjectedScript.h:
            * inspector/InjectedScriptHost.cpp:
            (WebCore::InjectedScriptHost::evaluate):
            (WebCore::InjectedScriptHost::evaluateInCallFrame):
            (WebCore::InjectedScriptHost::evaluateOnSelf):
            (WebCore::InjectedScriptHost::getCompletions):
            (WebCore::InjectedScriptHost::getProperties):
            (WebCore::InjectedScriptHost::pushNodeToFrontend):
            (WebCore::InjectedScriptHost::resolveNode):
            (WebCore::InjectedScriptHost::getNodeProperties):
            (WebCore::InjectedScriptHost::getNodePrototypes):
            (WebCore::InjectedScriptHost::setPropertyValue):
            (WebCore::InjectedScriptHost::injectedScriptForObjectId):
            (WebCore::InjectedScriptHost::injectedScriptForNodeId):
            (WebCore::InjectedScriptHost::injectedScriptForMainWorld):
            * inspector/InjectedScriptHost.h:
            * inspector/InjectedScriptSource.js:
            (.):
            * inspector/Inspector.idl:
            * inspector/InspectorController.cpp:
            * inspector/InspectorController.h:
            * inspector/InspectorValues.cpp:
            (WebCore::InspectorObject::getNumber):
            * inspector/InspectorValues.h:
            * inspector/front-end/AuditRules.js:
            (WebInspector.AuditRules.evaluateInTargetWindow):
            * inspector/front-end/ConsoleView.js:
            (WebInspector.ConsoleView.prototype.completions):
            (WebInspector.ConsoleView.prototype.doEvalInWindow):
            * inspector/front-end/ElementsTreeOutline.js:
            (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
            * inspector/front-end/ExtensionPanel.js:
            (WebInspector.ExtensionWatchSidebarPane.prototype.setExpression):
            * inspector/front-end/ExtensionServer.js:
            (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage):
            * inspector/front-end/InjectedScriptAccess.js: Removed.
            * inspector/front-end/PropertiesSidebarPane.js:
            (WebInspector.PropertiesSidebarPane.prototype.update.callback):
            (WebInspector.PropertiesSidebarPane.prototype.update):
            * inspector/front-end/RemoteObject.js:
            (WebInspector.RemoteObject.resolveNode):
            (WebInspector.RemoteObject.prototype.getProperties):
            (WebInspector.RemoteObject.prototype.setPropertyValue):
            (WebInspector.RemoteObject.prototype.pushNodeToFrontend):
            * inspector/front-end/ScriptsPanel.js:
            (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame):
            * inspector/front-end/WebKit.qrc:
            * inspector/front-end/inspector.html:
    2011-01-18  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
            https://bugs.webkit.org/show_bug.cgi?id=52652
    
            Calls served by the InjectedScript should be first class protocol
            citizens, not dispatched via single protocol message.
    
            * src/js/Tests.js:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76105 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 517a8b8..9431759 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-18  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
+        https://bugs.webkit.org/show_bug.cgi?id=52652
+
+        Calls served by the InjectedScript should be first class protocol
+        citizens, not dispatched via single protocol message.
+
+        * http/tests/inspector/extensions-test.js:
+        (initialize_ExtensionsTest.InspectorTest.runExtensionTests):
+        * http/tests/inspector/inspector-test2.js:
+        (initialize_InspectorTest.InspectorTest.evaluateInPage):
+        * http/tests/inspector/resource-har-conversion.html:
+        * inspector/console-command-clear.html:
+        * inspector/console-dir-global.html:
+
 2011-01-18  Eric Seidel  <eric at webkit.org>
 
         Unreviewed, rolling out r76084.
diff --git a/LayoutTests/http/tests/inspector/extensions-test.js b/LayoutTests/http/tests/inspector/extensions-test.js
index 438b62b..311c429 100644
--- a/LayoutTests/http/tests/inspector/extensions-test.js
+++ b/LayoutTests/http/tests/inspector/extensions-test.js
@@ -34,7 +34,7 @@ InspectorTest.dispatchOnMessage = function(messageId, callback, recurring)
 
 InspectorTest.runExtensionTests = function()
 {
-    InjectedScriptAccess.getDefault().evaluate("location.href", "console", function(result) {
+    InspectorBackend.evaluate("location.href", "console", function(result) {
         var pageURL = result.description;
         var extensionURL = (/^https?:/.test(pageURL) ?
             pageURL.replace(/^(https?:\/\/[^/]*\/).*$/,"$1") :
diff --git a/LayoutTests/http/tests/inspector/inspector-test2.js b/LayoutTests/http/tests/inspector/inspector-test2.js
index 302caf1..f1982c8 100644
--- a/LayoutTests/http/tests/inspector/inspector-test2.js
+++ b/LayoutTests/http/tests/inspector/inspector-test2.js
@@ -24,7 +24,7 @@ InspectorTest.evaluateInConsole = function(code, callback)
 
 InspectorTest.evaluateInPage = function(code, callback)
 {
-    InjectedScriptAccess.getDefault().evaluate(code, "console", callback || function() {});
+    InspectorBackend.evaluate(code, "console", callback || function() {});
 }
 
 InspectorTest.evaluateInPageWithTimeout = function(code, callback)
diff --git a/LayoutTests/http/tests/inspector/resource-har-conversion.html b/LayoutTests/http/tests/inspector/resource-har-conversion.html
index 51c7894..9c58fd2 100644
--- a/LayoutTests/http/tests/inspector/resource-har-conversion.html
+++ b/LayoutTests/http/tests/inspector/resource-har-conversion.html
@@ -26,7 +26,7 @@ var test = function()
     }
 
     InspectorTest.reloadPageIfNeeded(function() {
-        InjectedScriptAccess.getDefault().evaluate("doXHR()", "console", function() {
+        InspectorBackend.evaluate("doXHR()", "console", function() {
             addCookieHeadersToResource(findResourceByURL(/inspector-test2\.js$/));
             var entries = (new WebInspector.HARLog()).build().entries;
             entries.sort(InspectorTest.resourceURLComparer);
diff --git a/LayoutTests/inspector/console-command-clear.html b/LayoutTests/inspector/console-command-clear.html
index 9cb2f5c..f870ec9 100644
--- a/LayoutTests/inspector/console-command-clear.html
+++ b/LayoutTests/inspector/console-command-clear.html
@@ -17,7 +17,7 @@ function doit()
         output("=== After clear ==="); 
         dumpConsoleMessages();
     }
-    evaluateInWebInspector("InjectedScriptAccess.getDefault().evaluate('clear()', '', function() {})", callback);
+    evaluateInWebInspector("InspectorBackend.evaluate('clear()', '', function() {})", callback);
 }
 
 </script>
diff --git a/LayoutTests/inspector/console-dir-global.html b/LayoutTests/inspector/console-dir-global.html
index 93ef6cc..76e6ccb 100644
--- a/LayoutTests/inspector/console-dir-global.html
+++ b/LayoutTests/inspector/console-dir-global.html
@@ -22,7 +22,7 @@ function frontend_expandAndDumpConsoleMessages(testController)
     // Need test to be async to expand console objects.
     testController.waitUntilDone();
 
-    InjectedScriptAccess.getDefault().evaluate("window", "console", evalCallback);
+    InspectorBackend.evaluate("window", "console", evalCallback);
 
     function evalCallback(result)
     {
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index ecb45f9..762fdc3 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,77 @@
+2011-01-18  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
+        https://bugs.webkit.org/show_bug.cgi?id=52652
+
+        Calls served by the InjectedScript should be first class protocol
+        citizens, not dispatched via single protocol message.
+
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/InjectedScript.cpp:
+        (WebCore::InjectedScript::evaluate):
+        (WebCore::InjectedScript::evaluateInCallFrame):
+        (WebCore::InjectedScript::evaluateOnSelf):
+        (WebCore::InjectedScript::getCompletions):
+        (WebCore::InjectedScript::getProperties):
+        (WebCore::InjectedScript::pushNodeToFrontend):
+        (WebCore::InjectedScript::resolveNode):
+        (WebCore::InjectedScript::getNodeProperties):
+        (WebCore::InjectedScript::getNodePrototypes):
+        (WebCore::InjectedScript::setPropertyValue):
+        (WebCore::InjectedScript::makeCall):
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScriptHost.cpp:
+        (WebCore::InjectedScriptHost::evaluate):
+        (WebCore::InjectedScriptHost::evaluateInCallFrame):
+        (WebCore::InjectedScriptHost::evaluateOnSelf):
+        (WebCore::InjectedScriptHost::getCompletions):
+        (WebCore::InjectedScriptHost::getProperties):
+        (WebCore::InjectedScriptHost::pushNodeToFrontend):
+        (WebCore::InjectedScriptHost::resolveNode):
+        (WebCore::InjectedScriptHost::getNodeProperties):
+        (WebCore::InjectedScriptHost::getNodePrototypes):
+        (WebCore::InjectedScriptHost::setPropertyValue):
+        (WebCore::InjectedScriptHost::injectedScriptForObjectId):
+        (WebCore::InjectedScriptHost::injectedScriptForNodeId):
+        (WebCore::InjectedScriptHost::injectedScriptForMainWorld):
+        * inspector/InjectedScriptHost.h:
+        * inspector/InjectedScriptSource.js:
+        (.):
+        * inspector/Inspector.idl:
+        * inspector/InspectorController.cpp:
+        * inspector/InspectorController.h:
+        * inspector/InspectorValues.cpp:
+        (WebCore::InspectorObject::getNumber):
+        * inspector/InspectorValues.h:
+        * inspector/front-end/AuditRules.js:
+        (WebInspector.AuditRules.evaluateInTargetWindow):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype.completions):
+        (WebInspector.ConsoleView.prototype.doEvalInWindow):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
+        * inspector/front-end/ExtensionPanel.js:
+        (WebInspector.ExtensionWatchSidebarPane.prototype.setExpression):
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage):
+        * inspector/front-end/InjectedScriptAccess.js: Removed.
+        * inspector/front-end/PropertiesSidebarPane.js:
+        (WebInspector.PropertiesSidebarPane.prototype.update.callback):
+        (WebInspector.PropertiesSidebarPane.prototype.update):
+        * inspector/front-end/RemoteObject.js:
+        (WebInspector.RemoteObject.resolveNode):
+        (WebInspector.RemoteObject.prototype.getProperties):
+        (WebInspector.RemoteObject.prototype.setPropertyValue):
+        (WebInspector.RemoteObject.prototype.pushNodeToFrontend):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+
 2011-01-18  Anton Muhin  <antonm at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 06288fc..89758cb 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -4649,7 +4649,6 @@
             'inspector/front-end/ImageView.js',
             'inspector/front-end/InspectorFrontendHostStub.js',
             'inspector/front-end/InjectedFakeWorker.js',
-            'inspector/front-end/InjectedScriptAccess.js',
             'inspector/front-end/inspector.js',
             'inspector/front-end/KeyboardShortcut.js',
             'inspector/front-end/MetricsSidebarPane.js',
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index 526bb06..8ba3c4c 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -65469,10 +65469,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\inspector\front-end\InjectedScriptAccess.js"
-					>
-				</File>
-				<File
 					RelativePath="..\inspector\front-end\inspector.css"
 					>
 				</File>
diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.pm b/Source/WebCore/inspector/CodeGeneratorInspector.pm
index b7be15e..16a6070 100644
--- a/Source/WebCore/inspector/CodeGeneratorInspector.pm
+++ b/Source/WebCore/inspector/CodeGeneratorInspector.pm
@@ -55,6 +55,10 @@ $typeTransform{"FileSystem"} = {
     "header" => "InspectorFileSystemAgent.h",
     "domainAccessor" => "m_inspectorController->m_fileSystemAgent",
 };
+$typeTransform{"InjectedScript"} = {
+    "forwardHeader" => "InjectedScriptHost.h",
+    "domainAccessor" => "m_inspectorController->m_injectedScriptHost",
+};
 $typeTransform{"Inspector"} = {
     "forwardHeader" => "InspectorController.h",
     "domainAccessor" => "m_inspectorController",
@@ -87,7 +91,8 @@ $typeTransform{"Object"} = {
     "defaultValue" => "InspectorObject::create()",
     "forward" => "InspectorObject",
     "header" => "InspectorValues.h",
-    "JSONType" => "Object"
+    "JSONType" => "Object",
+    "JSType" => "object"
 };
 $typeTransform{"Array"} = {
     "param" => "PassRefPtr<InspectorArray>",
@@ -95,7 +100,8 @@ $typeTransform{"Array"} = {
     "defaultValue" => "InspectorArray::create()",
     "forward" => "InspectorArray",
     "header" => "InspectorValues.h",
-    "JSONType" => "Array"
+    "JSONType" => "Array",
+    "JSType" => "object"
 };
 $typeTransform{"Value"} = {
     "param" => "PassRefPtr<InspectorValue>",
@@ -103,7 +109,8 @@ $typeTransform{"Value"} = {
     "defaultValue" => "InspectorValue::null()",
     "forward" => "InspectorValue",
     "header" => "InspectorValues.h",
-    "JSONType" => "Value"
+    "JSONType" => "Value",
+    "JSType" => ""
 };
 $typeTransform{"String"} = {
     "param" => "const String&",
@@ -112,7 +119,8 @@ $typeTransform{"String"} = {
     "defaultValue" => "\"\"",
     "forwardHeader" => "wtf/Forward.h",
     "header" => "PlatformString.h",
-    "JSONType" => "String"
+    "JSONType" => "String",
+    "JSType" => "string"
 };
 $typeTransform{"long"} = {
     "param" => "long",
@@ -120,7 +128,8 @@ $typeTransform{"long"} = {
     "defaultValue" => "0",
     "forward" => "",
     "header" => "",
-    "JSONType" => "Number"
+    "JSONType" => "Number",
+    "JSType" => "number"
 };
 $typeTransform{"int"} = {
     "param" => "int",
@@ -129,6 +138,7 @@ $typeTransform{"int"} = {
     "forward" => "",
     "header" => "",
     "JSONType" => "Number",
+    "JSType" => "number"
 };
 $typeTransform{"unsigned long"} = {
     "param" => "unsigned long",
@@ -136,7 +146,8 @@ $typeTransform{"unsigned long"} = {
     "defaultValue" => "0u",
     "forward" => "",
     "header" => "",
-    "JSONType" => "Number"
+    "JSONType" => "Number",
+    "JSType" => "number"
 };
 $typeTransform{"unsigned int"} = {
     "param" => "unsigned int",
@@ -144,7 +155,8 @@ $typeTransform{"unsigned int"} = {
     "defaultValue" => "0u",
     "forward" => "",
     "header" => "",
-    "JSONType" => "Number"
+    "JSONType" => "Number",
+    "JSType" => "number"
 };
 $typeTransform{"double"} = {
     "param" => "double",
@@ -152,7 +164,8 @@ $typeTransform{"double"} = {
     "defaultValue" => "0.0",
     "forward" => "",
     "header" => "",
-    "JSONType" => "Number"
+    "JSONType" => "Number",
+    "JSType" => "number"
 };
 $typeTransform{"boolean"} = {
     "param" => "bool",
@@ -160,7 +173,8 @@ $typeTransform{"boolean"} = {
     "defaultValue" => "false",
     "forward" => "",
     "header" => "",
-    "JSONType" => "Boolean"
+    "JSONType" => "Boolean",
+    "JSType" => "boolean"
 };
 $typeTransform{"void"} = {
     "forward" => "",
@@ -567,7 +581,7 @@ sub generateBackendStubJS
     foreach my $function (@backendFunctions) {
         my $name = $function->signature->name;
         my $domain = $function->signature->extendedAttributes->{"domain"};
-        my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . lc($typeTransform{$_->type}->{"JSONType"}) . "\"", grep($_->direction eq "in", @{$function->parameters})));
+        my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . $typeTransform{$_->type}->{"JSType"} . "\"", grep($_->direction eq "in", @{$function->parameters})));
         push(@JSStubs, "    this._registerDelegate('{" .
             "\"seq\": 0, " .
             "\"domain\": \"$domain\", " .
@@ -625,7 +639,7 @@ InspectorBackendStub.prototype = {
                 return;
             }
             var value = args.shift();
-            if (typeof value !== request.arguments[key]) {
+            if (request.arguments[key] && typeof value !== request.arguments[key]) {
                 console.error("Protocol Error: Invalid type of argument '%s' for 'InspectorBackend.%s' call. It should be '%s' but it is '%s'.", key, request.command, request.arguments[key], typeof value);
                 return;
             }
diff --git a/Source/WebCore/inspector/InjectedScript.cpp b/Source/WebCore/inspector/InjectedScript.cpp
index 3f4d819..f284627 100644
--- a/Source/WebCore/inspector/InjectedScript.cpp
+++ b/Source/WebCore/inspector/InjectedScript.cpp
@@ -44,21 +44,86 @@ InjectedScript::InjectedScript(ScriptObject injectedScriptObject)
 {
 }
 
-void InjectedScript::dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException) 
+void InjectedScript::evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
 {
-    ASSERT(!hasNoValue());
-    if (!canAccessInspectedWindow()) {
-        *hadException = true;
-        return;
-    }
+    ScriptFunctionCall function(m_injectedScriptObject, "evaluate");
+    function.appendArgument(expression);
+    function.appendArgument(objectGroup);
+    makeCall(function, result);
+}
 
-    ScriptFunctionCall function(m_injectedScriptObject, "dispatch");
-    function.appendArgument(methodName);
-    function.appendArgument(arguments);
-    *hadException = false;
-    ScriptValue resultValue = function.call(*hadException);
-    if (!*hadException)
-        *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
+void InjectedScript::evaluateInCallFrame(long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "evaluateInCallFrame");
+    function.appendArgument(callFrame);
+    function.appendArgument(expression);
+    function.appendArgument(objectGroup);
+    makeCall(function, result);
+}
+
+void InjectedScript::evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnSelf");
+    function.appendArgument(functionBody);
+    function.appendArgument(argumentsArray->toJSONString());
+    makeCall(function, result);
+}
+
+void InjectedScript::getCompletions(const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "getCompletions");
+    function.appendArgument(expression);
+    function.appendArgument(includeInspectorCommandLineAPI);
+    function.appendArgument(callFrameId);
+    makeCall(function, result);
+}
+
+void InjectedScript::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "getProperties");
+    String objectIdString = objectId->toJSONString();
+    function.appendArgument(objectIdString);
+    function.appendArgument(ignoreHasOwnProperty);
+    function.appendArgument(abbreviate);
+    makeCall(function, result);
+}
+
+void InjectedScript::pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "pushNodeToFrontend");
+    function.appendArgument(objectId->toJSONString());
+    makeCall(function, result);
+}
+
+void InjectedScript::resolveNode(long nodeId, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "resolveNode");
+    function.appendArgument(nodeId);
+    makeCall(function, result);
+}
+
+void InjectedScript::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "getNodeProperties");
+    function.appendArgument(nodeId);
+    function.appendArgument(propertiesArray->toJSONString());
+    makeCall(function, result);
+}
+
+void InjectedScript::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "getNodePrototypes");
+    function.appendArgument(nodeId);
+    makeCall(function, result);
+}
+
+void InjectedScript::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
+{
+    ScriptFunctionCall function(m_injectedScriptObject, "getNodeProperties");
+    function.appendArgument(objectId->toJSONString());
+    function.appendArgument(propertyName);
+    function.appendArgument(expression);
+    makeCall(function, result);
 }
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
@@ -91,11 +156,29 @@ void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup)
     releaseFunction.appendArgument(objectGroup);
     releaseFunction.call();
 }
+
 bool InjectedScript::canAccessInspectedWindow()
 {
     return InjectedScriptHost::canAccessInspectedWindow(m_injectedScriptObject.scriptState());
 }
 
+void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValue>* result)
+{
+    if (hasNoValue() || !canAccessInspectedWindow()) {
+        *result = InspectorValue::null();
+        return;
+    }
+
+    bool hadException = false;
+    ScriptValue resultValue = function.call(hadException);
+
+    ASSERT(!hadException);
+    if (!hadException)
+        *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
+    else
+        *result = InspectorValue::null();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/InjectedScript.h b/Source/WebCore/inspector/InjectedScript.h
index f80cfb4..9fb4c50 100644
--- a/Source/WebCore/inspector/InjectedScript.h
+++ b/Source/WebCore/inspector/InjectedScript.h
@@ -36,10 +36,12 @@
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
 class InspectorValue;
+class ScriptFunctionCall;
 
 class InjectedScript {
 public:
@@ -48,10 +50,21 @@ public:
 
     bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
 
-    void dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException);
+    void evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
+    void evaluateInCallFrame(long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
+    void evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result);
+    void getCompletions(const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result);
+    void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
+    void pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result);
+    void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
+    void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
+    void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result);
+    void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
+
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     PassRefPtr<InspectorValue> callFrames();
 #endif
+
     PassRefPtr<InspectorValue> wrapForConsole(ScriptValue);
     void releaseWrapperObjectGroup(const String&);
     ScriptState* scriptState() const { return m_injectedScriptObject.scriptState(); }
@@ -60,6 +73,9 @@ private:
     friend InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState*);
     explicit InjectedScript(ScriptObject);
     bool canAccessInspectedWindow();
+
+    void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result);
+
     ScriptObject m_injectedScriptObject;
 };
 
diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp
index 3fd70e4..f23d8ec 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.cpp
+++ b/Source/WebCore/inspector/InjectedScriptHost.cpp
@@ -30,22 +30,21 @@
 
 #include "config.h"
 #include "InjectedScriptHost.h"
-#include "InjectedScriptSource.h"
-#include "InspectorDatabaseAgent.h"
-#include "InspectorDOMStorageAgent.h"
 
 #if ENABLE(INSPECTOR)
 
-
 #include "Element.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "HTMLFrameOwnerElement.h"
 #include "InjectedScript.h"
+#include "InjectedScriptSource.h"
 #include "InspectorClient.h"
 #include "InspectorConsoleAgent.h"
 #include "InspectorController.h"
 #include "InspectorDOMAgent.h"
+#include "InspectorDOMStorageAgent.h"
+#include "InspectorDatabaseAgent.h"
 #include "InspectorFrontend.h"
 #include "Pasteboard.h"
 
@@ -81,6 +80,76 @@ InjectedScriptHost::~InjectedScriptHost()
 {
 }
 
+void InjectedScriptHost::evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForMainWorld();
+    if (!injectedScript.hasNoValue())
+        injectedScript.evaluate(expression, objectGroup, result);
+}
+
+void InjectedScriptHost::evaluateInCallFrame(long injectedScriptId, long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptId ? m_idToInjectedScript.get(injectedScriptId) : injectedScriptForMainWorld();
+    if (!injectedScript.hasNoValue())
+        injectedScript.evaluateInCallFrame(callFrame, expression, objectGroup, result);
+}
+
+void InjectedScriptHost::evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForMainWorld();
+    if (!injectedScript.hasNoValue())
+        injectedScript.evaluateOnSelf(functionBody, argumentsArray, result);
+}
+
+void InjectedScriptHost::getCompletions(long injectedScriptId, const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptId ? m_idToInjectedScript.get(injectedScriptId) : injectedScriptForMainWorld();
+    if (!injectedScript.hasNoValue())
+        injectedScript.getCompletions(expression, includeInspectorCommandLineAPI, callFrameId, result);
+}
+
+void InjectedScriptHost::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForObjectId(objectId.get());
+    if (!injectedScript.hasNoValue())
+        injectedScript.getProperties(objectId, ignoreHasOwnProperty, abbreviate, result);
+}
+
+void InjectedScriptHost::pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForObjectId(objectId.get());
+    if (!injectedScript.hasNoValue())
+        injectedScript.pushNodeToFrontend(objectId, result);
+}
+
+void InjectedScriptHost::resolveNode(long nodeId, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
+    if (!injectedScript.hasNoValue())
+        injectedScript.resolveNode(nodeId, result);
+}
+
+void InjectedScriptHost::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
+    if (!injectedScript.hasNoValue())
+        injectedScript.getNodeProperties(nodeId, propertiesArray, result);
+}
+
+void InjectedScriptHost::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
+    if (!injectedScript.hasNoValue())
+        injectedScript.getNodePrototypes(nodeId, result);
+}
+
+void InjectedScriptHost::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
+{
+    InjectedScript injectedScript = injectedScriptForObjectId(objectId.get());
+    if (!injectedScript.hasNoValue())
+        injectedScript.setPropertyValue(objectId, propertyName, expression, result);
+}
+
 void InjectedScriptHost::clearConsoleMessages()
 {
     if (m_inspectorController)
@@ -214,6 +283,43 @@ void InjectedScriptHost::didDestroyWorker(long id)
 }
 #endif // ENABLE(WORKERS)
 
+InjectedScript InjectedScriptHost::injectedScriptForObjectId(InspectorObject* objectId)
+{
+    long injectedScriptId = 0;
+    bool success = objectId->getNumber("injectedScriptId", &injectedScriptId);
+    if (success)
+        return m_idToInjectedScript.get(injectedScriptId);
+    return InjectedScript();
+}
+
+InjectedScript InjectedScriptHost::injectedScriptForNodeId(long nodeId)
+{
+    if (!m_inspectorController)
+        return InjectedScript();
+
+    Frame* frame = 0;
+    if (nodeId) {
+        ASSERT(m_inspectorController->domAgent());
+        Node* node = m_inspectorController->domAgent()->nodeForId(nodeId);
+        if (node) {
+            Document* document = node->ownerDocument();
+            if (document)
+                frame = document->frame();
+        }
+    } else
+        frame = m_inspectorController->inspectedPage()->mainFrame();
+
+    if (frame)
+        return injectedScriptFor(mainWorldScriptState(frame));
+
+    return InjectedScript();
+}
+
+InjectedScript InjectedScriptHost::injectedScriptForMainWorld()
+{
+    return injectedScriptFor(mainWorldScriptState(m_inspectorController->inspectedPage()->mainFrame()));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h
index e9c09aa..4cb622d 100644
--- a/Source/WebCore/inspector/InjectedScriptHost.h
+++ b/Source/WebCore/inspector/InjectedScriptHost.h
@@ -58,6 +58,18 @@ public:
 
     ~InjectedScriptHost();
 
+    // Part of the protocol.
+    void evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
+    void evaluateInCallFrame(long injectedScriptId, long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
+    void evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result);
+    void getCompletions(long injectedScriptId, const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result);
+    void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
+    void pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result);
+    void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
+    void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
+    void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result);
+    void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
+
     InspectorController* inspectorController() { return m_inspectorController; }
     void disconnectController() { m_inspectorController = 0; }
 
@@ -97,6 +109,10 @@ private:
     ScriptObject createInjectedScript(const String& source, ScriptState* scriptState, long id);
     void discardInjectedScript(ScriptState*);
 
+    InjectedScript injectedScriptForObjectId(InspectorObject* objectId);
+    InjectedScript injectedScriptForNodeId(long nodeId);
+    InjectedScript injectedScriptForMainWorld();
+
     InspectorController* m_inspectorController;
     long m_nextInjectedScriptId;
     long m_lastWorkerId;
diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js
index eee5b14..4683997 100644
--- a/Source/WebCore/inspector/InjectedScriptSource.js
+++ b/Source/WebCore/inspector/InjectedScriptSource.js
@@ -60,7 +60,9 @@ InjectedScript.prototype = {
                     this._objectGroups[objectGroupName] = group;
                 }
                 group.push(id);
-                objectId = this._serializeObjectId(id, objectGroupName);
+                objectId = { injectedScriptId: injectedScriptId,
+                             id: id,
+                             groupName: objectGroupName };
             }
             return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate);
         } catch (e) {
@@ -68,18 +70,9 @@ InjectedScript.prototype = {
         }
     },
 
-    _serializeObjectId: function(id, groupName)
-    {
-        return injectedScriptId + ":" + id + ":" + groupName;
-    },
-
     _parseObjectId: function(objectId)
     {
-        var tokens = objectId.split(":");
-        var parsedObjectId = {};
-        parsedObjectId.id = parseInt(tokens[1]);
-        parsedObjectId.groupName = tokens[2];
-        return parsedObjectId;
+        return eval("(" + objectId + ")");
     },
 
     releaseWrapperObjectGroup: function(objectGroupName)
@@ -103,26 +96,11 @@ InjectedScript.prototype = {
         return result;
     },
 
-    getPrototypes: function(nodeId)
-    {
-        this.releaseWrapperObjectGroup("prototypes");
-        var node = this._nodeForId(nodeId);
-        if (!node)
-            return false;
-
-        var result = [];
-        var prototype = node;
-        do {
-            result.push(this._wrapObject(prototype, "prototypes"));
-            prototype = prototype.__proto__;
-        } while (prototype)
-        return result;
-    },
-
     getProperties: function(objectId, ignoreHasOwnProperty, abbreviate)
     {
         var parsedObjectId = this._parseObjectId(objectId);
         var object = this._objectForId(parsedObjectId);
+
         if (!this._isDefined(object))
             return false;
         var properties = [];
@@ -214,7 +192,7 @@ InjectedScript.prototype = {
         try {
             var expressionResult;
             // Evaluate on call frame if call frame id is available.
-            if (typeof callFrameId === "number") {
+            if (callFrameId !== -1) {
                 var callFrame = this._callFrameForId(callFrameId);
                 if (!callFrame)
                     return props;
@@ -323,9 +301,9 @@ InjectedScript.prototype = {
         return InjectedScriptHost.nodeForId(nodeId);
     },
 
-    _objectForId: function(parsedObjectId)
+    _objectForId: function(objectId)
     {
-        return this._idToWrappedObject[parsedObjectId.id];
+        return this._idToWrappedObject[objectId.id];
     },
 
     resolveNode: function(nodeId)
@@ -342,12 +320,29 @@ InjectedScript.prototype = {
         var node = this._nodeForId(nodeId);
         if (!node)
             return false;
+        properties = eval("(" + properties + ")");
         var result = {};
         for (var i = 0; i < properties.length; ++i)
             result[properties[i]] = node[properties[i]];
         return result;
     },
 
+    getNodePrototypes: function(nodeId)
+    {
+        this.releaseWrapperObjectGroup("prototypes");
+        var node = this._nodeForId(nodeId);
+        if (!node)
+            return false;
+
+        var result = [];
+        var prototype = node;
+        do {
+            result.push(this._wrapObject(prototype, "prototypes"));
+            prototype = prototype.__proto__;
+        } while (prototype)
+        return result;
+    },
+
     pushNodeToFrontend: function(objectId)
     {
         var parsedObjectId = this._parseObjectId(objectId);
@@ -359,8 +354,8 @@ InjectedScript.prototype = {
 
     evaluateOnSelf: function(funcBody, args)
     {
-        var func = window.eval("(" + funcBody + ")");
-        return func.apply(this, args || []);
+        var func = eval("(" + funcBody + ")");
+        return func.apply(this, eval("(" + args + ")") || []);
     },
 
     _isDefined: function(object)
diff --git a/Source/WebCore/inspector/Inspector.idl b/Source/WebCore/inspector/Inspector.idl
index e4bbcc5..739c336 100644
--- a/Source/WebCore/inspector/Inspector.idl
+++ b/Source/WebCore/inspector/Inspector.idl
@@ -36,8 +36,6 @@ module core {
         // generic Inspector's methods
         ///////////////////////////////////////////////////////////////////////
 
-        // HUGE FIXME: we need to expose InjectedScript methods here. Or document InjectedScript capabilities.
-        [domain=Inspector] 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=Inspector] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup);
@@ -73,6 +71,21 @@ module core {
         [domain=Inspector] void deleteCookie(in String cookieName, in String domain);
 
         ///////////////////////////////////////////////////////////////////////
+        // Injected Script
+        ///////////////////////////////////////////////////////////////////////
+
+        [domain=InjectedScript] void evaluate(in String expression, in String objectGroup, out Value result);
+        [domain=InjectedScript] void evaluateInCallFrame(in long injectedScriptId, in long callFrame, in String expression, in String objectGroup, out Value result);
+        [domain=InjectedScript] void evaluateOnSelf(in String functionBody, in Array argumentsArray, out Value result);
+        [domain=InjectedScript] void getCompletions(in long injectedScriptId, in String expression, in boolean includeInspectorCommandLineAPI, in long callFrameId, out Value result);
+        [domain=InjectedScript] void getProperties(in Object objectId, in boolean ignoreHasOwnProperty, in boolean abbreviate, out Value result);
+        [domain=InjectedScript] void pushNodeToFrontend(in Object objectId, out Value result);
+        [domain=InjectedScript] void resolveNode(in long nodeId, out Value result);
+        [domain=InjectedScript] void getNodeProperties(in long nodeId, in Array propertiesArray, out Value result);
+        [domain=InjectedScript] void getNodePrototypes(in long nodeId, out Value result);
+        [domain=InjectedScript] void setPropertyValue(in Object objectId, in String propertyName, in String expression, out Value result);
+
+        ///////////////////////////////////////////////////////////////////////
         // Console API
         ///////////////////////////////////////////////////////////////////////
 
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index 1b3ad35..380c057 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -1157,26 +1157,6 @@ void InspectorController::restoreStickyBreakpoint(PassRefPtr<InspectorObject> br
 }
 #endif
 
-void InspectorController::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException)
-{
-    if (!m_frontend)
-        return;
-
-    // FIXME: explicitly pass injectedScriptId along with node id to the frontend.
-    bool injectedScriptIdIsNodeId = injectedScriptId <= 0;
-
-    InjectedScript injectedScript;
-    if (injectedScriptIdIsNodeId)
-        injectedScript = injectedScriptForNodeId(-injectedScriptId);
-    else
-        injectedScript = injectedScriptHost()->injectedScriptForId(injectedScriptId);
-
-    if (injectedScript.hasNoValue())
-        return;
-
-    injectedScript.dispatch(methodName, arguments, result, hadException);
-}
-
 void InspectorController::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
 {
     injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup);
@@ -1464,27 +1444,6 @@ void InspectorController::openInInspectedWindow(const String& url)
     newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
 }
 
-InjectedScript InspectorController::injectedScriptForNodeId(long id)
-{
-
-    Frame* frame = 0;
-    if (id) {
-        ASSERT(m_domAgent);
-        Node* node = m_domAgent->nodeForId(id);
-        if (node) {
-            Document* document = node->ownerDocument();
-            if (document)
-                frame = document->frame();
-        }
-    } else
-        frame = m_inspectedPage->mainFrame();
-
-    if (frame)
-        return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
-
-    return InjectedScript();
-}
-
 void InspectorController::addScriptToEvaluateOnLoad(const String& source)
 {
     m_scriptsToEvaluateOnLoad.append(source);
diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h
index 9cddc56..405139c 100644
--- a/Source/WebCore/inspector/InspectorController.h
+++ b/Source/WebCore/inspector/InspectorController.h
@@ -224,16 +224,11 @@ public:
     void setStickyBreakpoints(PassRefPtr<InspectorObject> breakpoints);
 #endif
 
-    void setInjectedScriptSource(const String& source);
-    void dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException);
-
     // Generic code called from custom implementations.
     void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup);
 
     void evaluateForTestInFrontend(long testCallId, const String& script);
 
-    InjectedScript injectedScriptForNodeId(long id);
-
     void addScriptToEvaluateOnLoad(const String& source);
     void removeAllScriptsToEvaluateOnLoad();
     void setInspectorExtensionAPI(const String& source);
@@ -283,9 +278,7 @@ private:
     PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>&);
 
     void focusNode();
-
     bool isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl);
-
     void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
 
     Page* m_inspectedPage;
diff --git a/Source/WebCore/inspector/InspectorValues.cpp b/Source/WebCore/inspector/InspectorValues.cpp
index 89e9b7c..d1b8093 100644
--- a/Source/WebCore/inspector/InspectorValues.cpp
+++ b/Source/WebCore/inspector/InspectorValues.cpp
@@ -647,6 +647,14 @@ bool InspectorObject::getBoolean(const String& name, bool* output) const
     return value->asBoolean(output);
 }
 
+bool InspectorObject::getNumber(const String& name, long* output) const
+{
+    RefPtr<InspectorValue> value = get(name);
+    if (!value)
+        return false;
+    return value->asNumber(output);
+}
+
 bool InspectorObject::getNumber(const String& name, double* output) const
 {
     RefPtr<InspectorValue> value = get(name);
diff --git a/Source/WebCore/inspector/InspectorValues.h b/Source/WebCore/inspector/InspectorValues.h
index 391372e..843f369 100644
--- a/Source/WebCore/inspector/InspectorValues.h
+++ b/Source/WebCore/inspector/InspectorValues.h
@@ -180,6 +180,7 @@ public:
 
     const_iterator find(const String& name) const;
     bool getBoolean(const String& name, bool* output) const;
+    bool getNumber(const String& name, long* output) const;
     bool getNumber(const String& name, double* output) const;
     bool getString(const String& name, String* output) const;
     PassRefPtr<InspectorObject> getObject(const String& name) const;
diff --git a/Source/WebCore/inspector/front-end/AuditRules.js b/Source/WebCore/inspector/front-end/AuditRules.js
index 7aa891f..c2bbcbb 100644
--- a/Source/WebCore/inspector/front-end/AuditRules.js
+++ b/Source/WebCore/inspector/front-end/AuditRules.js
@@ -65,7 +65,7 @@ WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, nee
 
 WebInspector.AuditRules.evaluateInTargetWindow = function(func, args, callback)
 {
-    InjectedScriptAccess.getDefault().evaluateOnSelf(func.toString(), args, callback);
+    InspectorBackend.evaluateOnSelf(func.toString(), args, callback);
 }
 
 
@@ -721,7 +721,7 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
             return nodeIds;
         }
 
-        WebInspector.AuditRules.evaluateInTargetWindow(pushImageNodes, null, receivedImages);
+        WebInspector.AuditRules.evaluateInTargetWindow(pushImageNodes, [], receivedImages);
     }
 }
 
@@ -797,7 +797,7 @@ WebInspector.AuditRules.CssInHeadRule.prototype = {
             return found ? urlToViolationsArray : null;
         }
 
-        WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback);
+        WebInspector.AuditRules.evaluateInTargetWindow(routine, [], evalCallback);
     }
 }
 
@@ -844,7 +844,7 @@ WebInspector.AuditRules.StylesScriptsOrderRule.prototype = {
             return [ lateStyleUrls, cssBeforeInlineCount ];
         }
 
-        WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback.bind(this));
+        WebInspector.AuditRules.evaluateInTargetWindow(routine, [], evalCallback.bind(this));
     }
 }
 
diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js
index 5adfcac..843c2b3 100644
--- a/Source/WebCore/inspector/front-end/ConsoleView.js
+++ b/Source/WebCore/inspector/front-end/ConsoleView.js
@@ -355,14 +355,14 @@ WebInspector.ConsoleView.prototype = {
         // Collect comma separated object properties for the completion.
 
         var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation);
-        var callFrameId = WebInspector.panels.scripts.selectedCallFrameId();
+        var callFrameId = WebInspector.panels.scripts.selectedCallFrameId() || -1;
         var injectedScriptAccess;
         if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) {
             var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame;
-            injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.worldId);
+            var injectedScriptId = selectedCallFrame.worldId;
         } else
-            injectedScriptAccess = InjectedScriptAccess.getDefault();
-        injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions);
+            var injectedScriptId = 0;
+        InspectorBackend.getCompletions(injectedScriptId, expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions);
     },
 
     _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) {
@@ -532,8 +532,8 @@ WebInspector.ConsoleView.prototype = {
         function evalCallback(result)
         {
             callback(WebInspector.RemoteObject.fromPayload(result));
-        };
-        InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback);
+        }
+        InspectorBackend.evaluate(expression, objectGroup, evalCallback);
     },
 
     _enterKeyPressed: function(event)
diff --git a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js
index 67d34b2..722c028 100644
--- a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -411,8 +411,7 @@ WebInspector.ElementsTreeElement.prototype = {
             else
                 this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight);
         }
-
-        InjectedScriptAccess.getForNode(node).getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
+        InspectorBackend.getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
     },
 
     updateSelection: function()
diff --git a/Source/WebCore/inspector/front-end/ExtensionPanel.js b/Source/WebCore/inspector/front-end/ExtensionPanel.js
index 4b42e68..fb98350 100644
--- a/Source/WebCore/inspector/front-end/ExtensionPanel.js
+++ b/Source/WebCore/inspector/front-end/ExtensionPanel.js
@@ -95,7 +95,7 @@ WebInspector.ExtensionWatchSidebarPane.prototype = {
 
     setExpression: function(expression, title)
     {
-        InjectedScriptAccess.getDefault().evaluate(expression, this._onEvaluate.bind(this, title));
+        InspectorBackend.evaluate(expression, "extension-watch", this._onEvaluate.bind(this, title));
     },
 
     _onEvaluate: function(title, result)
diff --git a/Source/WebCore/inspector/front-end/ExtensionServer.js b/Source/WebCore/inspector/front-end/ExtensionServer.js
index b97dcda..0924106 100644
--- a/Source/WebCore/inspector/front-end/ExtensionServer.js
+++ b/Source/WebCore/inspector/front-end/ExtensionServer.js
@@ -272,7 +272,7 @@ WebInspector.ExtensionServer.prototype = {
         var evalExpression = "JSON.stringify(eval('" +
             "with (window.console._commandLineAPI) with (window) {' + unescape('" + escape(message.expression) +
             "') + '}'));";
-        InjectedScriptAccess.getDefault().evaluate(evalExpression, callback.bind(this));
+        InspectorBackend.evaluate(evalExpression, "none", callback.bind(this));
     },
 
     _onRevealAndSelect: function(message)
diff --git a/Source/WebCore/inspector/front-end/InjectedScriptAccess.js b/Source/WebCore/inspector/front-end/InjectedScriptAccess.js
deleted file mode 100644
index cb3c2b8..0000000
--- a/Source/WebCore/inspector/front-end/InjectedScriptAccess.js
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-function InjectedScriptAccess(worldId) {
-    this._worldId = worldId;
-}
-
-InjectedScriptAccess.get = function(worldId)
-{
-    if (typeof worldId === "number")
-        return new InjectedScriptAccess(worldId);
-
-    console.assert(false, "Access to injected script with no id");
-}
-
-InjectedScriptAccess.getForNode = function(node)
-{
-    // FIXME: do something.
-    return InjectedScriptAccess.get(-node.id);
-}
-
-InjectedScriptAccess.getForObjectId = function(objectId)
-{
-    // FIXME: move to native layer.
-    var tokens = objectId.split(":");
-    return InjectedScriptAccess.get(parseInt(tokens[0]));
-}
-
-InjectedScriptAccess.getDefault = function()
-{
-    return InjectedScriptAccess.get(0);
-}
-
-InjectedScriptAccess.prototype = {};
-
-InjectedScriptAccess._installHandler = function(methodName, async)
-{
-    InjectedScriptAccess.prototype[methodName] = function()
-    {
-        var allArgs = Array.prototype.slice.call(arguments);
-        var callback = allArgs[allArgs.length - 1];
-        var argsString = JSON.stringify(Array.prototype.slice.call(allArgs, 0, allArgs.length - 1));
-        
-        function myCallback(result, isException)
-        {
-            if (!isException)
-                callback(result);
-            else
-                WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage("Error dispatching: " + methodName));
-        }
-        InspectorBackend.dispatchOnInjectedScript(this._worldId, methodName, argsString, myCallback);
-    };
-}
-
-// InjectedScriptAccess message forwarding puts some constraints on the way methods are implemented and called:
-// - Make sure corresponding methods in InjectedScript return non-null and non-undefined values,
-// - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function.
-// We keep these sorted.
-InjectedScriptAccess._installHandler("evaluate");
-InjectedScriptAccess._installHandler("evaluateInCallFrame");
-InjectedScriptAccess._installHandler("evaluateOnSelf");
-InjectedScriptAccess._installHandler("getCompletions");
-InjectedScriptAccess._installHandler("getProperties");
-InjectedScriptAccess._installHandler("getPrototypes");
-InjectedScriptAccess._installHandler("pushNodeToFrontend");
-InjectedScriptAccess._installHandler("resolveNode");
-InjectedScriptAccess._installHandler("getNodeProperties");
-InjectedScriptAccess._installHandler("setPropertyValue");
diff --git a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
index b9c212a..a1e37bc 100644
--- a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js
@@ -42,11 +42,11 @@ WebInspector.PropertiesSidebarPane.prototype = {
             return;
         }
 
-        var self = this;
-        var callback = function(prototypes) {
-            var body = self.bodyElement;
+        function callback(prototypes)
+        {
+            var body = this.bodyElement;
             body.removeChildren();
-            self.sections = [];
+            this.sections = [];
 
             // Get array of prototype user-friendly names.
             for (var i = 0; i < prototypes.length; ++i) {
@@ -55,11 +55,11 @@ WebInspector.PropertiesSidebarPane.prototype = {
                 if (title.match(/Prototype$/))
                     title = title.replace(/Prototype$/, "");
                 var section = new WebInspector.ObjectPropertiesSection(prototype, title);
-                self.sections.push(section);
+                this.sections.push(section);
                 body.appendChild(section.element);
             }
-        };
-        InjectedScriptAccess.getForNode(node).getPrototypes(node.id, callback);
+        }
+        InspectorBackend.getNodePrototypes(node.id, callback.bind(this));
     }
 }
 
diff --git a/Source/WebCore/inspector/front-end/RemoteObject.js b/Source/WebCore/inspector/front-end/RemoteObject.js
index 4d6736c..10af2e3 100644
--- a/Source/WebCore/inspector/front-end/RemoteObject.js
+++ b/Source/WebCore/inspector/front-end/RemoteObject.js
@@ -52,7 +52,7 @@ WebInspector.RemoteObject.resolveNode = function(node, callback)
     {
         callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
     }
-    InjectedScriptAccess.getForNode(node).resolveNode(node.id, mycallback);
+    InspectorBackend.resolveNode(node.id, mycallback);
 }
 
 WebInspector.RemoteObject.fromPayload = function(payload)
@@ -118,7 +118,7 @@ WebInspector.RemoteObject.prototype = {
                 properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value);
             callback(properties);
         }
-        InjectedScriptAccess.getForObjectId(this._objectId).getProperties(this._objectId, ignoreHasOwnProperty, abbreviate, remoteObjectBinder);
+        InspectorBackend.getProperties(this._objectId, !!ignoreHasOwnProperty, abbreviate, remoteObjectBinder);
     },
 
     setPropertyValue: function(name, value, callback)
@@ -127,12 +127,12 @@ WebInspector.RemoteObject.prototype = {
             callback(false);
             return;
         }
-        InjectedScriptAccess.getForObjectId(this._objectId).setPropertyValue(this._objectId, name, value, callback);
+        InspectorBackend.setPropertyValue(this._objectId, name, value, callback);
     },
 
     pushNodeToFrontend: function(callback)
     {
-        InjectedScriptAccess.getForObjectId(this._objectId).pushNodeToFrontend(this._objectId, callback);
+        InspectorBackend.pushNodeToFrontend(this._objectId, callback);
     }
 }
 
diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js
index edb0d23..6af124b 100644
--- a/Source/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js
@@ -366,7 +366,7 @@ WebInspector.ScriptsPanel.prototype = {
             if (result)
                 callback(WebInspector.RemoteObject.fromPayload(result));
         }
-        InjectedScriptAccess.get(callFrame.worldId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback);
+        InspectorBackend.evaluateInCallFrame(callFrame.worldId, callFrame.id, code, objectGroup, evalCallback);
     },
 
     _debuggerPaused: function(event)
diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc
index db92ff3..cd68bf9 100644
--- a/Source/WebCore/inspector/front-end/WebKit.qrc
+++ b/Source/WebCore/inspector/front-end/WebKit.qrc
@@ -51,7 +51,6 @@
     <file>HelpScreen.js</file>
     <file>ImageView.js</file>
     <file>InjectedFakeWorker.js</file>
-    <file>InjectedScriptAccess.js</file>
     <file>inspector.js</file>
     <file>InspectorFrontendHostStub.js</file>
     <file>KeyboardShortcut.js</file>
diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html
index 7055092..ca6d412 100644
--- a/Source/WebCore/inspector/front-end/inspector.html
+++ b/Source/WebCore/inspector/front-end/inspector.html
@@ -143,7 +143,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="HeapSnapshotView.js"></script>
     <script type="text/javascript" src="DebuggerModel.js"></script>
     <script type="text/javascript" src="DOMAgent.js"></script>
-    <script type="text/javascript" src="InjectedScriptAccess.js"></script>
     <script type="text/javascript" src="TimelineAgent.js"></script>
     <script type="text/javascript" src="TimelinePanel.js"></script>
     <script type="text/javascript" src="TimelineOverviewPane.js"></script>
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog
index 0fea222..8414ef9 100644
--- a/Source/WebKit/chromium/ChangeLog
+++ b/Source/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-18  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
+        https://bugs.webkit.org/show_bug.cgi?id=52652
+
+        Calls served by the InjectedScript should be first class protocol
+        citizens, not dispatched via single protocol message.
+
+        * src/js/Tests.js:
+
 2011-01-18  Victoria Kirst  <vrk at chromium.org>
 
         Reviewed by Kenneth Russell.
diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js
index f2e8dcb..6ed8e49 100644
--- a/Source/WebKit/chromium/src/js/Tests.js
+++ b/Source/WebKit/chromium/src/js/Tests.js
@@ -741,32 +741,6 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb
 
 
 /**
- * Executes the 'code' with InjectedScriptAccess.getProperties overriden
- * so that all callbacks passed to InjectedScriptAccess.getProperties are
- * extended with the "hook".
- * @param {Function} hook The hook function.
- * @param {Function} code A code snippet to be executed.
- */
-TestSuite.prototype._hookGetPropertiesCallback = function(hook, code)
-{
-    var accessor = InjectedScriptAccess.prototype;
-    var orig = accessor.getProperties;
-    accessor.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) {
-        orig.call(this, objectProxy, ignoreHasOwnProperty, abbreviate,
-            function() {
-              callback.apply(this, arguments);
-              hook();
-            });
-    };
-    try {
-        code();
-    } finally {
-        accessor.getProperties = orig;
-    }
-};
-
-
-/**
  * Key event with given key identifier.
  */
 TestSuite.createKeyEvent = function(keyIdentifier)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list