Changeset 76105 in webkit


Ignore:
Timestamp:
Jan 19, 2011 1:00:58 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2011-01-18 Pavel Feldman <pfeldman@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@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@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:
Location:
trunk
Files:
1 deleted
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76102 r76105  
     12011-01-18  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
     6        https://bugs.webkit.org/show_bug.cgi?id=52652
     7
     8        Calls served by the InjectedScript should be first class protocol
     9        citizens, not dispatched via single protocol message.
     10
     11        * http/tests/inspector/extensions-test.js:
     12        (initialize_ExtensionsTest.InspectorTest.runExtensionTests):
     13        * http/tests/inspector/inspector-test2.js:
     14        (initialize_InspectorTest.InspectorTest.evaluateInPage):
     15        * http/tests/inspector/resource-har-conversion.html:
     16        * inspector/console-command-clear.html:
     17        * inspector/console-dir-global.html:
     18
    1192011-01-18  Eric Seidel  <eric@webkit.org>
    220
  • trunk/LayoutTests/http/tests/inspector/extensions-test.js

    r74234 r76105  
    3535InspectorTest.runExtensionTests = function()
    3636{
    37     InjectedScriptAccess.getDefault().evaluate("location.href", "console", function(result) {
     37    InspectorBackend.evaluate("location.href", "console", function(result) {
    3838        var pageURL = result.description;
    3939        var extensionURL = (/^https?:/.test(pageURL) ?
  • trunk/LayoutTests/http/tests/inspector/inspector-test2.js

    r74634 r76105  
    2525InspectorTest.evaluateInPage = function(code, callback)
    2626{
    27     InjectedScriptAccess.getDefault().evaluate(code, "console", callback || function() {});
     27    InspectorBackend.evaluate(code, "console", callback || function() {});
    2828}
    2929
  • trunk/LayoutTests/http/tests/inspector/resource-har-conversion.html

    r75786 r76105  
    2727
    2828    InspectorTest.reloadPageIfNeeded(function() {
    29         InjectedScriptAccess.getDefault().evaluate("doXHR()", "console", function() {
     29        InspectorBackend.evaluate("doXHR()", "console", function() {
    3030            addCookieHeadersToResource(findResourceByURL(/inspector-test2\.js$/));
    3131            var entries = (new WebInspector.HARLog()).build().entries;
  • trunk/LayoutTests/inspector/console-command-clear.html

    r65412 r76105  
    1818        dumpConsoleMessages();
    1919    }
    20     evaluateInWebInspector("InjectedScriptAccess.getDefault().evaluate('clear()', '', function() {})", callback);
     20    evaluateInWebInspector("InspectorBackend.evaluate('clear()', '', function() {})", callback);
    2121}
    2222
  • trunk/LayoutTests/inspector/console-dir-global.html

    r65248 r76105  
    2323    testController.waitUntilDone();
    2424
    25     InjectedScriptAccess.getDefault().evaluate("window", "console", evalCallback);
     25    InspectorBackend.evaluate("window", "console", evalCallback);
    2626
    2727    function evalCallback(result)
  • trunk/Source/WebCore/ChangeLog

    r76104 r76105  
     12011-01-18  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
     6        https://bugs.webkit.org/show_bug.cgi?id=52652
     7
     8        Calls served by the InjectedScript should be first class protocol
     9        citizens, not dispatched via single protocol message.
     10
     11        * WebCore.gypi:
     12        * WebCore.vcproj/WebCore.vcproj:
     13        * inspector/CodeGeneratorInspector.pm:
     14        * inspector/InjectedScript.cpp:
     15        (WebCore::InjectedScript::evaluate):
     16        (WebCore::InjectedScript::evaluateInCallFrame):
     17        (WebCore::InjectedScript::evaluateOnSelf):
     18        (WebCore::InjectedScript::getCompletions):
     19        (WebCore::InjectedScript::getProperties):
     20        (WebCore::InjectedScript::pushNodeToFrontend):
     21        (WebCore::InjectedScript::resolveNode):
     22        (WebCore::InjectedScript::getNodeProperties):
     23        (WebCore::InjectedScript::getNodePrototypes):
     24        (WebCore::InjectedScript::setPropertyValue):
     25        (WebCore::InjectedScript::makeCall):
     26        * inspector/InjectedScript.h:
     27        * inspector/InjectedScriptHost.cpp:
     28        (WebCore::InjectedScriptHost::evaluate):
     29        (WebCore::InjectedScriptHost::evaluateInCallFrame):
     30        (WebCore::InjectedScriptHost::evaluateOnSelf):
     31        (WebCore::InjectedScriptHost::getCompletions):
     32        (WebCore::InjectedScriptHost::getProperties):
     33        (WebCore::InjectedScriptHost::pushNodeToFrontend):
     34        (WebCore::InjectedScriptHost::resolveNode):
     35        (WebCore::InjectedScriptHost::getNodeProperties):
     36        (WebCore::InjectedScriptHost::getNodePrototypes):
     37        (WebCore::InjectedScriptHost::setPropertyValue):
     38        (WebCore::InjectedScriptHost::injectedScriptForObjectId):
     39        (WebCore::InjectedScriptHost::injectedScriptForNodeId):
     40        (WebCore::InjectedScriptHost::injectedScriptForMainWorld):
     41        * inspector/InjectedScriptHost.h:
     42        * inspector/InjectedScriptSource.js:
     43        (.):
     44        * inspector/Inspector.idl:
     45        * inspector/InspectorController.cpp:
     46        * inspector/InspectorController.h:
     47        * inspector/InspectorValues.cpp:
     48        (WebCore::InspectorObject::getNumber):
     49        * inspector/InspectorValues.h:
     50        * inspector/front-end/AuditRules.js:
     51        (WebInspector.AuditRules.evaluateInTargetWindow):
     52        * inspector/front-end/ConsoleView.js:
     53        (WebInspector.ConsoleView.prototype.completions):
     54        (WebInspector.ConsoleView.prototype.doEvalInWindow):
     55        * inspector/front-end/ElementsTreeOutline.js:
     56        (WebInspector.ElementsTreeElement.prototype._createTooltipForNode):
     57        * inspector/front-end/ExtensionPanel.js:
     58        (WebInspector.ExtensionWatchSidebarPane.prototype.setExpression):
     59        * inspector/front-end/ExtensionServer.js:
     60        (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage):
     61        * inspector/front-end/InjectedScriptAccess.js: Removed.
     62        * inspector/front-end/PropertiesSidebarPane.js:
     63        (WebInspector.PropertiesSidebarPane.prototype.update.callback):
     64        (WebInspector.PropertiesSidebarPane.prototype.update):
     65        * inspector/front-end/RemoteObject.js:
     66        (WebInspector.RemoteObject.resolveNode):
     67        (WebInspector.RemoteObject.prototype.getProperties):
     68        (WebInspector.RemoteObject.prototype.setPropertyValue):
     69        (WebInspector.RemoteObject.prototype.pushNodeToFrontend):
     70        * inspector/front-end/ScriptsPanel.js:
     71        (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame):
     72        * inspector/front-end/WebKit.qrc:
     73        * inspector/front-end/inspector.html:
     74
    1752011-01-18  Anton Muhin  <antonm@chromium.org>
    276
  • trunk/Source/WebCore/WebCore.gypi

    r76098 r76105  
    46504650            'inspector/front-end/InspectorFrontendHostStub.js',
    46514651            'inspector/front-end/InjectedFakeWorker.js',
    4652             'inspector/front-end/InjectedScriptAccess.js',
    46534652            'inspector/front-end/inspector.js',
    46544653            'inspector/front-end/KeyboardShortcut.js',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r76098 r76105  
    6547065470                                </File>
    6547165471                                <File
    65472                                         RelativePath="..\inspector\front-end\InjectedScriptAccess.js"
    65473                                         >
    65474                                 </File>
    65475                                 <File
    6547665472                                        RelativePath="..\inspector\front-end\inspector.css"
    6547765473                                        >
  • trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm

    r75792 r76105  
    5555    "header" => "InspectorFileSystemAgent.h",
    5656    "domainAccessor" => "m_inspectorController->m_fileSystemAgent",
     57};
     58$typeTransform{"InjectedScript"} = {
     59    "forwardHeader" => "InjectedScriptHost.h",
     60    "domainAccessor" => "m_inspectorController->m_injectedScriptHost",
    5761};
    5862$typeTransform{"Inspector"} = {
     
    8892    "forward" => "InspectorObject",
    8993    "header" => "InspectorValues.h",
    90     "JSONType" => "Object"
     94    "JSONType" => "Object",
     95    "JSType" => "object"
    9196};
    9297$typeTransform{"Array"} = {
     
    96101    "forward" => "InspectorArray",
    97102    "header" => "InspectorValues.h",
    98     "JSONType" => "Array"
     103    "JSONType" => "Array",
     104    "JSType" => "object"
    99105};
    100106$typeTransform{"Value"} = {
     
    104110    "forward" => "InspectorValue",
    105111    "header" => "InspectorValues.h",
    106     "JSONType" => "Value"
     112    "JSONType" => "Value",
     113    "JSType" => ""
    107114};
    108115$typeTransform{"String"} = {
     
    113120    "forwardHeader" => "wtf/Forward.h",
    114121    "header" => "PlatformString.h",
    115     "JSONType" => "String"
     122    "JSONType" => "String",
     123    "JSType" => "string"
    116124};
    117125$typeTransform{"long"} = {
     
    121129    "forward" => "",
    122130    "header" => "",
    123     "JSONType" => "Number"
     131    "JSONType" => "Number",
     132    "JSType" => "number"
    124133};
    125134$typeTransform{"int"} = {
     
    130139    "header" => "",
    131140    "JSONType" => "Number",
     141    "JSType" => "number"
    132142};
    133143$typeTransform{"unsigned long"} = {
     
    137147    "forward" => "",
    138148    "header" => "",
    139     "JSONType" => "Number"
     149    "JSONType" => "Number",
     150    "JSType" => "number"
    140151};
    141152$typeTransform{"unsigned int"} = {
     
    145156    "forward" => "",
    146157    "header" => "",
    147     "JSONType" => "Number"
     158    "JSONType" => "Number",
     159    "JSType" => "number"
    148160};
    149161$typeTransform{"double"} = {
     
    153165    "forward" => "",
    154166    "header" => "",
    155     "JSONType" => "Number"
     167    "JSONType" => "Number",
     168    "JSType" => "number"
    156169};
    157170$typeTransform{"boolean"} = {
     
    161174    "forward" => "",
    162175    "header" => "",
    163     "JSONType" => "Boolean"
     176    "JSONType" => "Boolean",
     177    "JSType" => "boolean"
    164178};
    165179$typeTransform{"void"} = {
     
    568582        my $name = $function->signature->name;
    569583        my $domain = $function->signature->extendedAttributes->{"domain"};
    570         my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . lc($typeTransform{$_->type}->{"JSONType"}) . "\"", grep($_->direction eq "in", @{$function->parameters})));
     584        my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . $typeTransform{$_->type}->{"JSType"} . "\"", grep($_->direction eq "in", @{$function->parameters})));
    571585        push(@JSStubs, "    this._registerDelegate('{" .
    572586            "\"seq\": 0, " .
     
    626640            }
    627641            var value = args.shift();
    628             if (typeof value !== request.arguments[key]) {
     642            if (request.arguments[key] && typeof value !== request.arguments[key]) {
    629643                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);
    630644                return;
  • trunk/Source/WebCore/inspector/InjectedScript.cpp

    r65072 r76105  
    4545}
    4646
    47 void InjectedScript::dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException)
     47void InjectedScript::evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
    4848{
    49     ASSERT(!hasNoValue());
    50     if (!canAccessInspectedWindow()) {
    51         *hadException = true;
    52         return;
    53     }
     49    ScriptFunctionCall function(m_injectedScriptObject, "evaluate");
     50    function.appendArgument(expression);
     51    function.appendArgument(objectGroup);
     52    makeCall(function, result);
     53}
    5454
    55     ScriptFunctionCall function(m_injectedScriptObject, "dispatch");
    56     function.appendArgument(methodName);
    57     function.appendArgument(arguments);
    58     *hadException = false;
    59     ScriptValue resultValue = function.call(*hadException);
    60     if (!*hadException)
    61         *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
     55void InjectedScript::evaluateInCallFrame(long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
     56{
     57    ScriptFunctionCall function(m_injectedScriptObject, "evaluateInCallFrame");
     58    function.appendArgument(callFrame);
     59    function.appendArgument(expression);
     60    function.appendArgument(objectGroup);
     61    makeCall(function, result);
     62}
     63
     64void InjectedScript::evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result)
     65{
     66    ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnSelf");
     67    function.appendArgument(functionBody);
     68    function.appendArgument(argumentsArray->toJSONString());
     69    makeCall(function, result);
     70}
     71
     72void InjectedScript::getCompletions(const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result)
     73{
     74    ScriptFunctionCall function(m_injectedScriptObject, "getCompletions");
     75    function.appendArgument(expression);
     76    function.appendArgument(includeInspectorCommandLineAPI);
     77    function.appendArgument(callFrameId);
     78    makeCall(function, result);
     79}
     80
     81void InjectedScript::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
     82{
     83    ScriptFunctionCall function(m_injectedScriptObject, "getProperties");
     84    String objectIdString = objectId->toJSONString();
     85    function.appendArgument(objectIdString);
     86    function.appendArgument(ignoreHasOwnProperty);
     87    function.appendArgument(abbreviate);
     88    makeCall(function, result);
     89}
     90
     91void InjectedScript::pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result)
     92{
     93    ScriptFunctionCall function(m_injectedScriptObject, "pushNodeToFrontend");
     94    function.appendArgument(objectId->toJSONString());
     95    makeCall(function, result);
     96}
     97
     98void InjectedScript::resolveNode(long nodeId, RefPtr<InspectorValue>* result)
     99{
     100    ScriptFunctionCall function(m_injectedScriptObject, "resolveNode");
     101    function.appendArgument(nodeId);
     102    makeCall(function, result);
     103}
     104
     105void InjectedScript::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
     106{
     107    ScriptFunctionCall function(m_injectedScriptObject, "getNodeProperties");
     108    function.appendArgument(nodeId);
     109    function.appendArgument(propertiesArray->toJSONString());
     110    makeCall(function, result);
     111}
     112
     113void InjectedScript::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result)
     114{
     115    ScriptFunctionCall function(m_injectedScriptObject, "getNodePrototypes");
     116    function.appendArgument(nodeId);
     117    makeCall(function, result);
     118}
     119
     120void InjectedScript::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
     121{
     122    ScriptFunctionCall function(m_injectedScriptObject, "getNodeProperties");
     123    function.appendArgument(objectId->toJSONString());
     124    function.appendArgument(propertyName);
     125    function.appendArgument(expression);
     126    makeCall(function, result);
    62127}
    63128
     
    92157    releaseFunction.call();
    93158}
     159
    94160bool InjectedScript::canAccessInspectedWindow()
    95161{
     
    97163}
    98164
     165void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValue>* result)
     166{
     167    if (hasNoValue() || !canAccessInspectedWindow()) {
     168        *result = InspectorValue::null();
     169        return;
     170    }
     171
     172    bool hadException = false;
     173    ScriptValue resultValue = function.call(hadException);
     174
     175    ASSERT(!hadException);
     176    if (!hadException)
     177        *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
     178    else
     179        *result = InspectorValue::null();
     180}
     181
    99182} // namespace WebCore
    100183
  • trunk/Source/WebCore/inspector/InjectedScript.h

    r65730 r76105  
    3737#include <wtf/Noncopyable.h>
    3838#include <wtf/PassRefPtr.h>
     39#include <wtf/RefPtr.h>
    3940
    4041namespace WebCore {
    4142
    4243class InspectorValue;
     44class ScriptFunctionCall;
    4345
    4446class InjectedScript {
     
    4951    bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
    5052
    51     void dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException);
     53    void evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
     54    void evaluateInCallFrame(long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
     55    void evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result);
     56    void getCompletions(const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result);
     57    void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
     58    void pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result);
     59    void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
     60    void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
     61    void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result);
     62    void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
     63
    5264#if ENABLE(JAVASCRIPT_DEBUGGER)
    5365    PassRefPtr<InspectorValue> callFrames();
    5466#endif
     67
    5568    PassRefPtr<InspectorValue> wrapForConsole(ScriptValue);
    5669    void releaseWrapperObjectGroup(const String&);
     
    6174    explicit InjectedScript(ScriptObject);
    6275    bool canAccessInspectedWindow();
     76
     77    void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result);
     78
    6379    ScriptObject m_injectedScriptObject;
    6480};
  • trunk/Source/WebCore/inspector/InjectedScriptHost.cpp

    r75792 r76105  
    3131#include "config.h"
    3232#include "InjectedScriptHost.h"
    33 #include "InjectedScriptSource.h"
    34 #include "InspectorDatabaseAgent.h"
    35 #include "InspectorDOMStorageAgent.h"
    3633
    3734#if ENABLE(INSPECTOR)
    38 
    3935
    4036#include "Element.h"
     
    4339#include "HTMLFrameOwnerElement.h"
    4440#include "InjectedScript.h"
     41#include "InjectedScriptSource.h"
    4542#include "InspectorClient.h"
    4643#include "InspectorConsoleAgent.h"
    4744#include "InspectorController.h"
    4845#include "InspectorDOMAgent.h"
     46#include "InspectorDOMStorageAgent.h"
     47#include "InspectorDatabaseAgent.h"
    4948#include "InspectorFrontend.h"
    5049#include "Pasteboard.h"
     
    8079InjectedScriptHost::~InjectedScriptHost()
    8180{
     81}
     82
     83void InjectedScriptHost::evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
     84{
     85    InjectedScript injectedScript = injectedScriptForMainWorld();
     86    if (!injectedScript.hasNoValue())
     87        injectedScript.evaluate(expression, objectGroup, result);
     88}
     89
     90void InjectedScriptHost::evaluateInCallFrame(long injectedScriptId, long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result)
     91{
     92    InjectedScript injectedScript = injectedScriptId ? m_idToInjectedScript.get(injectedScriptId) : injectedScriptForMainWorld();
     93    if (!injectedScript.hasNoValue())
     94        injectedScript.evaluateInCallFrame(callFrame, expression, objectGroup, result);
     95}
     96
     97void InjectedScriptHost::evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result)
     98{
     99    InjectedScript injectedScript = injectedScriptForMainWorld();
     100    if (!injectedScript.hasNoValue())
     101        injectedScript.evaluateOnSelf(functionBody, argumentsArray, result);
     102}
     103
     104void InjectedScriptHost::getCompletions(long injectedScriptId, const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result)
     105{
     106    InjectedScript injectedScript = injectedScriptId ? m_idToInjectedScript.get(injectedScriptId) : injectedScriptForMainWorld();
     107    if (!injectedScript.hasNoValue())
     108        injectedScript.getCompletions(expression, includeInspectorCommandLineAPI, callFrameId, result);
     109}
     110
     111void InjectedScriptHost::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
     112{
     113    InjectedScript injectedScript = injectedScriptForObjectId(objectId.get());
     114    if (!injectedScript.hasNoValue())
     115        injectedScript.getProperties(objectId, ignoreHasOwnProperty, abbreviate, result);
     116}
     117
     118void InjectedScriptHost::pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result)
     119{
     120    InjectedScript injectedScript = injectedScriptForObjectId(objectId.get());
     121    if (!injectedScript.hasNoValue())
     122        injectedScript.pushNodeToFrontend(objectId, result);
     123}
     124
     125void InjectedScriptHost::resolveNode(long nodeId, RefPtr<InspectorValue>* result)
     126{
     127    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
     128    if (!injectedScript.hasNoValue())
     129        injectedScript.resolveNode(nodeId, result);
     130}
     131
     132void InjectedScriptHost::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
     133{
     134    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
     135    if (!injectedScript.hasNoValue())
     136        injectedScript.getNodeProperties(nodeId, propertiesArray, result);
     137}
     138
     139void InjectedScriptHost::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result)
     140{
     141    InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
     142    if (!injectedScript.hasNoValue())
     143        injectedScript.getNodePrototypes(nodeId, result);
     144}
     145
     146void InjectedScriptHost::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
     147{
     148    InjectedScript injectedScript = injectedScriptForObjectId(objectId.get());
     149    if (!injectedScript.hasNoValue())
     150        injectedScript.setPropertyValue(objectId, propertyName, expression, result);
    82151}
    83152
     
    215284#endif // ENABLE(WORKERS)
    216285
     286InjectedScript InjectedScriptHost::injectedScriptForObjectId(InspectorObject* objectId)
     287{
     288    long injectedScriptId = 0;
     289    bool success = objectId->getNumber("injectedScriptId", &injectedScriptId);
     290    if (success)
     291        return m_idToInjectedScript.get(injectedScriptId);
     292    return InjectedScript();
     293}
     294
     295InjectedScript InjectedScriptHost::injectedScriptForNodeId(long nodeId)
     296{
     297    if (!m_inspectorController)
     298        return InjectedScript();
     299
     300    Frame* frame = 0;
     301    if (nodeId) {
     302        ASSERT(m_inspectorController->domAgent());
     303        Node* node = m_inspectorController->domAgent()->nodeForId(nodeId);
     304        if (node) {
     305            Document* document = node->ownerDocument();
     306            if (document)
     307                frame = document->frame();
     308        }
     309    } else
     310        frame = m_inspectorController->inspectedPage()->mainFrame();
     311
     312    if (frame)
     313        return injectedScriptFor(mainWorldScriptState(frame));
     314
     315    return InjectedScript();
     316}
     317
     318InjectedScript InjectedScriptHost::injectedScriptForMainWorld()
     319{
     320    return injectedScriptFor(mainWorldScriptState(m_inspectorController->inspectedPage()->mainFrame()));
     321}
     322
    217323} // namespace WebCore
    218324
  • trunk/Source/WebCore/inspector/InjectedScriptHost.h

    r75715 r76105  
    5959    ~InjectedScriptHost();
    6060
     61    // Part of the protocol.
     62    void evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
     63    void evaluateInCallFrame(long injectedScriptId, long callFrame, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result);
     64    void evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result);
     65    void getCompletions(long injectedScriptId, const String& expression, bool includeInspectorCommandLineAPI, long callFrameId, RefPtr<InspectorValue>* result);
     66    void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
     67    void pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result);
     68    void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
     69    void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
     70    void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result);
     71    void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
     72
    6173    InspectorController* inspectorController() { return m_inspectorController; }
    6274    void disconnectController() { m_inspectorController = 0; }
     
    98110    void discardInjectedScript(ScriptState*);
    99111
     112    InjectedScript injectedScriptForObjectId(InspectorObject* objectId);
     113    InjectedScript injectedScriptForNodeId(long nodeId);
     114    InjectedScript injectedScriptForMainWorld();
     115
    100116    InspectorController* m_inspectorController;
    101117    long m_nextInjectedScriptId;
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r76013 r76105  
    6161                }
    6262                group.push(id);
    63                 objectId = this._serializeObjectId(id, objectGroupName);
     63                objectId = { injectedScriptId: injectedScriptId,
     64                             id: id,
     65                             groupName: objectGroupName };
    6466            }
    6567            return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate);
     
    6971    },
    7072
    71     _serializeObjectId: function(id, groupName)
    72     {
    73         return injectedScriptId + ":" + id + ":" + groupName;
    74     },
    75 
    7673    _parseObjectId: function(objectId)
    7774    {
    78         var tokens = objectId.split(":");
    79         var parsedObjectId = {};
    80         parsedObjectId.id = parseInt(tokens[1]);
    81         parsedObjectId.groupName = tokens[2];
    82         return parsedObjectId;
     75        return eval("(" + objectId + ")");
    8376    },
    8477
     
    10497    },
    10598
    106     getPrototypes: function(nodeId)
    107     {
    108         this.releaseWrapperObjectGroup("prototypes");
    109         var node = this._nodeForId(nodeId);
    110         if (!node)
    111             return false;
    112 
    113         var result = [];
    114         var prototype = node;
    115         do {
    116             result.push(this._wrapObject(prototype, "prototypes"));
    117             prototype = prototype.__proto__;
    118         } while (prototype)
    119         return result;
    120     },
    121 
    12299    getProperties: function(objectId, ignoreHasOwnProperty, abbreviate)
    123100    {
    124101        var parsedObjectId = this._parseObjectId(objectId);
    125102        var object = this._objectForId(parsedObjectId);
     103
    126104        if (!this._isDefined(object))
    127105            return false;
     
    215193            var expressionResult;
    216194            // Evaluate on call frame if call frame id is available.
    217             if (typeof callFrameId === "number") {
     195            if (callFrameId !== -1) {
    218196                var callFrame = this._callFrameForId(callFrameId);
    219197                if (!callFrame)
     
    324302    },
    325303
    326     _objectForId: function(parsedObjectId)
    327     {
    328         return this._idToWrappedObject[parsedObjectId.id];
     304    _objectForId: function(objectId)
     305    {
     306        return this._idToWrappedObject[objectId.id];
    329307    },
    330308
     
    343321        if (!node)
    344322            return false;
     323        properties = eval("(" + properties + ")");
    345324        var result = {};
    346325        for (var i = 0; i < properties.length; ++i)
    347326            result[properties[i]] = node[properties[i]];
     327        return result;
     328    },
     329
     330    getNodePrototypes: function(nodeId)
     331    {
     332        this.releaseWrapperObjectGroup("prototypes");
     333        var node = this._nodeForId(nodeId);
     334        if (!node)
     335            return false;
     336
     337        var result = [];
     338        var prototype = node;
     339        do {
     340            result.push(this._wrapObject(prototype, "prototypes"));
     341            prototype = prototype.__proto__;
     342        } while (prototype)
    348343        return result;
    349344    },
     
    360355    evaluateOnSelf: function(funcBody, args)
    361356    {
    362         var func = window.eval("(" + funcBody + ")");
    363         return func.apply(this, args || []);
     357        var func = eval("(" + funcBody + ")");
     358        return func.apply(this, eval("(" + args + ")") || []);
    364359    },
    365360
  • trunk/Source/WebCore/inspector/Inspector.idl

    r76026 r76105  
    3737        ///////////////////////////////////////////////////////////////////////
    3838
    39         // HUGE FIXME: we need to expose InjectedScript methods here. Or document InjectedScript capabilities.
    40         [domain=Inspector] void dispatchOnInjectedScript(in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException);
    4139        [domain=Inspector] void addScriptToEvaluateOnLoad(in String scriptSource);
    4240        [domain=Inspector] void removeAllScriptsToEvaluateOnLoad();
     
    7270        [domain=Inspector] void getCookies(out Array cookies, out String cookiesString);
    7371        [domain=Inspector] void deleteCookie(in String cookieName, in String domain);
     72
     73        ///////////////////////////////////////////////////////////////////////
     74        // Injected Script
     75        ///////////////////////////////////////////////////////////////////////
     76
     77        [domain=InjectedScript] void evaluate(in String expression, in String objectGroup, out Value result);
     78        [domain=InjectedScript] void evaluateInCallFrame(in long injectedScriptId, in long callFrame, in String expression, in String objectGroup, out Value result);
     79        [domain=InjectedScript] void evaluateOnSelf(in String functionBody, in Array argumentsArray, out Value result);
     80        [domain=InjectedScript] void getCompletions(in long injectedScriptId, in String expression, in boolean includeInspectorCommandLineAPI, in long callFrameId, out Value result);
     81        [domain=InjectedScript] void getProperties(in Object objectId, in boolean ignoreHasOwnProperty, in boolean abbreviate, out Value result);
     82        [domain=InjectedScript] void pushNodeToFrontend(in Object objectId, out Value result);
     83        [domain=InjectedScript] void resolveNode(in long nodeId, out Value result);
     84        [domain=InjectedScript] void getNodeProperties(in long nodeId, in Array propertiesArray, out Value result);
     85        [domain=InjectedScript] void getNodePrototypes(in long nodeId, out Value result);
     86        [domain=InjectedScript] void setPropertyValue(in Object objectId, in String propertyName, in String expression, out Value result);
    7487
    7588        ///////////////////////////////////////////////////////////////////////
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r76021 r76105  
    11581158#endif
    11591159
    1160 void InspectorController::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException)
    1161 {
    1162     if (!m_frontend)
    1163         return;
    1164 
    1165     // FIXME: explicitly pass injectedScriptId along with node id to the frontend.
    1166     bool injectedScriptIdIsNodeId = injectedScriptId <= 0;
    1167 
    1168     InjectedScript injectedScript;
    1169     if (injectedScriptIdIsNodeId)
    1170         injectedScript = injectedScriptForNodeId(-injectedScriptId);
    1171     else
    1172         injectedScript = injectedScriptHost()->injectedScriptForId(injectedScriptId);
    1173 
    1174     if (injectedScript.hasNoValue())
    1175         return;
    1176 
    1177     injectedScript.dispatch(methodName, arguments, result, hadException);
    1178 }
    1179 
    11801160void InspectorController::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
    11811161{
     
    14651445}
    14661446
    1467 InjectedScript InspectorController::injectedScriptForNodeId(long id)
    1468 {
    1469 
    1470     Frame* frame = 0;
    1471     if (id) {
    1472         ASSERT(m_domAgent);
    1473         Node* node = m_domAgent->nodeForId(id);
    1474         if (node) {
    1475             Document* document = node->ownerDocument();
    1476             if (document)
    1477                 frame = document->frame();
    1478         }
    1479     } else
    1480         frame = m_inspectedPage->mainFrame();
    1481 
    1482     if (frame)
    1483         return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
    1484 
    1485     return InjectedScript();
    1486 }
    1487 
    14881447void InspectorController::addScriptToEvaluateOnLoad(const String& source)
    14891448{
  • trunk/Source/WebCore/inspector/InspectorController.h

    r75949 r76105  
    225225#endif
    226226
    227     void setInjectedScriptSource(const String& source);
    228     void dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException);
    229 
    230227    // Generic code called from custom implementations.
    231228    void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup);
    232229
    233230    void evaluateForTestInFrontend(long testCallId, const String& script);
    234 
    235     InjectedScript injectedScriptForNodeId(long id);
    236231
    237232    void addScriptToEvaluateOnLoad(const String& source);
     
    284279
    285280    void focusNode();
    286 
    287281    bool isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl);
    288 
    289282    void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
    290283
  • trunk/Source/WebCore/inspector/InspectorValues.cpp

    r70198 r76105  
    648648}
    649649
     650bool InspectorObject::getNumber(const String& name, long* output) const
     651{
     652    RefPtr<InspectorValue> value = get(name);
     653    if (!value)
     654        return false;
     655    return value->asNumber(output);
     656}
     657
    650658bool InspectorObject::getNumber(const String& name, double* output) const
    651659{
  • trunk/Source/WebCore/inspector/InspectorValues.h

    r69437 r76105  
    181181    const_iterator find(const String& name) const;
    182182    bool getBoolean(const String& name, bool* output) const;
     183    bool getNumber(const String& name, long* output) const;
    183184    bool getNumber(const String& name, double* output) const;
    184185    bool getString(const String& name, String* output) const;
  • trunk/Source/WebCore/inspector/front-end/AuditRules.js

    r75714 r76105  
    6666WebInspector.AuditRules.evaluateInTargetWindow = function(func, args, callback)
    6767{
    68     InjectedScriptAccess.getDefault().evaluateOnSelf(func.toString(), args, callback);
     68    InspectorBackend.evaluateOnSelf(func.toString(), args, callback);
    6969}
    7070
     
    722722        }
    723723
    724         WebInspector.AuditRules.evaluateInTargetWindow(pushImageNodes, null, receivedImages);
     724        WebInspector.AuditRules.evaluateInTargetWindow(pushImageNodes, [], receivedImages);
    725725    }
    726726}
     
    798798        }
    799799
    800         WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback);
     800        WebInspector.AuditRules.evaluateInTargetWindow(routine, [], evalCallback);
    801801    }
    802802}
     
    845845        }
    846846
    847         WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback.bind(this));
     847        WebInspector.AuditRules.evaluateInTargetWindow(routine, [], evalCallback.bind(this));
    848848    }
    849849}
  • trunk/Source/WebCore/inspector/front-end/ConsoleView.js

    r76019 r76105  
    356356
    357357        var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation);
    358         var callFrameId = WebInspector.panels.scripts.selectedCallFrameId();
     358        var callFrameId = WebInspector.panels.scripts.selectedCallFrameId() || -1;
    359359        var injectedScriptAccess;
    360360        if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) {
    361361            var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame;
    362             injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.worldId);
     362            var injectedScriptId = selectedCallFrame.worldId;
    363363        } else
    364             injectedScriptAccess = InjectedScriptAccess.getDefault();
    365         injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions);
     364            var injectedScriptId = 0;
     365        InspectorBackend.getCompletions(injectedScriptId, expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions);
    366366    },
    367367
     
    533533        {
    534534            callback(WebInspector.RemoteObject.fromPayload(result));
    535         };
    536         InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback);
     535        }
     536        InspectorBackend.evaluate(expression, objectGroup, evalCallback);
    537537    },
    538538
  • trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js

    r74634 r76105  
    412412                this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight);
    413413        }
    414 
    415         InjectedScriptAccess.getForNode(node).getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
     414        InspectorBackend.getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
    416415    },
    417416
  • trunk/Source/WebCore/inspector/front-end/ExtensionPanel.js

    r71107 r76105  
    9696    setExpression: function(expression, title)
    9797    {
    98         InjectedScriptAccess.getDefault().evaluate(expression, this._onEvaluate.bind(this, title));
     98        InspectorBackend.evaluate(expression, "extension-watch", this._onEvaluate.bind(this, title));
    9999    },
    100100
  • trunk/Source/WebCore/inspector/front-end/ExtensionServer.js

    r76030 r76105  
    273273            "with (window.console._commandLineAPI) with (window) {' + unescape('" + escape(message.expression) +
    274274            "') + '}'));";
    275         InjectedScriptAccess.getDefault().evaluate(evalExpression, callback.bind(this));
     275        InspectorBackend.evaluate(evalExpression, "none", callback.bind(this));
    276276    },
    277277
  • trunk/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js

    r71139 r76105  
    4343        }
    4444
    45         var self = this;
    46         var callback = function(prototypes) {
    47             var body = self.bodyElement;
     45        function callback(prototypes)
     46        {
     47            var body = this.bodyElement;
    4848            body.removeChildren();
    49             self.sections = [];
     49            this.sections = [];
    5050
    5151            // Get array of prototype user-friendly names.
     
    5656                    title = title.replace(/Prototype$/, "");
    5757                var section = new WebInspector.ObjectPropertiesSection(prototype, title);
    58                 self.sections.push(section);
     58                this.sections.push(section);
    5959                body.appendChild(section.element);
    6060            }
    61         };
    62         InjectedScriptAccess.getForNode(node).getPrototypes(node.id, callback);
     61        }
     62        InspectorBackend.getNodePrototypes(node.id, callback.bind(this));
    6363    }
    6464}
  • trunk/Source/WebCore/inspector/front-end/RemoteObject.js

    r71107 r76105  
    5353        callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
    5454    }
    55     InjectedScriptAccess.getForNode(node).resolveNode(node.id, mycallback);
     55    InspectorBackend.resolveNode(node.id, mycallback);
    5656}
    5757
     
    119119            callback(properties);
    120120        }
    121         InjectedScriptAccess.getForObjectId(this._objectId).getProperties(this._objectId, ignoreHasOwnProperty, abbreviate, remoteObjectBinder);
     121        InspectorBackend.getProperties(this._objectId, !!ignoreHasOwnProperty, abbreviate, remoteObjectBinder);
    122122    },
    123123
     
    128128            return;
    129129        }
    130         InjectedScriptAccess.getForObjectId(this._objectId).setPropertyValue(this._objectId, name, value, callback);
     130        InspectorBackend.setPropertyValue(this._objectId, name, value, callback);
    131131    },
    132132
    133133    pushNodeToFrontend: function(callback)
    134134    {
    135         InjectedScriptAccess.getForObjectId(this._objectId).pushNodeToFrontend(this._objectId, callback);
     135        InspectorBackend.pushNodeToFrontend(this._objectId, callback);
    136136    }
    137137}
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r76021 r76105  
    367367                callback(WebInspector.RemoteObject.fromPayload(result));
    368368        }
    369         InjectedScriptAccess.get(callFrame.worldId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback);
     369        InspectorBackend.evaluateInCallFrame(callFrame.worldId, callFrame.id, code, objectGroup, evalCallback);
    370370    },
    371371
  • trunk/Source/WebCore/inspector/front-end/WebKit.qrc

    r76009 r76105  
    5252    <file>ImageView.js</file>
    5353    <file>InjectedFakeWorker.js</file>
    54     <file>InjectedScriptAccess.js</file>
    5554    <file>inspector.js</file>
    5655    <file>InspectorFrontendHostStub.js</file>
  • trunk/Source/WebCore/inspector/front-end/inspector.html

    r76009 r76105  
    144144    <script type="text/javascript" src="DebuggerModel.js"></script>
    145145    <script type="text/javascript" src="DOMAgent.js"></script>
    146     <script type="text/javascript" src="InjectedScriptAccess.js"></script>
    147146    <script type="text/javascript" src="TimelineAgent.js"></script>
    148147    <script type="text/javascript" src="TimelinePanel.js"></script>
  • trunk/Source/WebKit/chromium/ChangeLog

    r76075 r76105  
     12011-01-18  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol.
     6        https://bugs.webkit.org/show_bug.cgi?id=52652
     7
     8        Calls served by the InjectedScript should be first class protocol
     9        citizens, not dispatched via single protocol message.
     10
     11        * src/js/Tests.js:
     12
    1132011-01-18  Victoria Kirst  <vrk@chromium.org>
    214
  • trunk/Source/WebKit/chromium/src/js/Tests.js

    r75938 r76105  
    742742
    743743/**
    744  * Executes the 'code' with InjectedScriptAccess.getProperties overriden
    745  * so that all callbacks passed to InjectedScriptAccess.getProperties are
    746  * extended with the "hook".
    747  * @param {Function} hook The hook function.
    748  * @param {Function} code A code snippet to be executed.
    749  */
    750 TestSuite.prototype._hookGetPropertiesCallback = function(hook, code)
    751 {
    752     var accessor = InjectedScriptAccess.prototype;
    753     var orig = accessor.getProperties;
    754     accessor.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) {
    755         orig.call(this, objectProxy, ignoreHasOwnProperty, abbreviate,
    756             function() {
    757               callback.apply(this, arguments);
    758               hook();
    759             });
    760     };
    761     try {
    762         code();
    763     } finally {
    764         accessor.getProperties = orig;
    765     }
    766 };
    767 
    768 
    769 /**
    770744 * Key event with given key identifier.
    771745 */
Note: See TracChangeset for help on using the changeset viewer.