⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249173 in webkit


Ignore:
Timestamp:
Aug 27, 2019, 2:40:11 PM (7 years ago)
Author:
Devin Rousso
Message:

Web Inspector: don't attach properties to injectedScript for the CommandLineAPI
https://bugs.webkit.org/show_bug.cgi?id=201193

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

For some reason, adding injectedScript._inspectObject inside CommandLineAPIModuleSource.js
causes inspector/debugger/tail-deleted-frames-this-value.html to fail.

We should have a similar approach to adding command line api getters and functions, in that
the CommandLineAPIModuleSource.js calls a function with a callback.

  • inspector/InjectedScriptSource.js:

(InjectedScript.prototype.inspectObject):
(InjectedScript.prototype.setInspectObject): Added.
(InjectedScript.prototype._evaluateOn):

Source/WebCore:

For some reason, adding injectedScript._inspectObject inside CommandLineAPIModuleSource.js
causes inspector/debugger/tail-deleted-frames-this-value.html to fail.

We should have a similar approach to adding command line api getters and functions, in that
the CommandLineAPIModuleSource.js calls a function with a callback.

  • inspector/CommandLineAPIModuleSource.js:

(injectedScript._inspectObject): Deleted.

LayoutTests:

  • http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt:
  • inspector/console/command-line-api-expected.txt:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249162 r249173  
     12019-08-27  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: don't attach properties to `injectedScript` for the CommandLineAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=201193
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt:
     9        * inspector/console/command-line-api-expected.txt:
     10
    1112019-08-27  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    212
  • trunk/LayoutTests/http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt

    r249078 r249173  
    1 CONSOLE MESSAGE: line 8: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
    2 CONSOLE MESSAGE: line 8: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
     1CONSOLE MESSAGE: line 6: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
     2CONSOLE MESSAGE: line 6: Blocked a frame with origin "http://localhost:8000" from accessing a frame with origin "http://127.0.0.1:8000". Protocols, domains, and ports must match.
    33Test that code evaluated in the main frame cannot access $0 that resolves to a node in a frame from a different domain. Bug 105423.
    44
  • trunk/LayoutTests/inspector/console/command-line-api-expected.txt

    r249078 r249173  
    1 CONSOLE MESSAGE: line 31: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
     1CONSOLE MESSAGE: line 29: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
    22Tests that command line api works.
    33
  • trunk/Source/JavaScriptCore/ChangeLog

    r249164 r249173  
     12019-08-27  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: don't attach properties to `injectedScript` for the CommandLineAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=201193
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        For some reason, adding `injectedScript._inspectObject` inside CommandLineAPIModuleSource.js
     9        causes inspector/debugger/tail-deleted-frames-this-value.html to fail.
     10
     11        We should have a similar approach to adding command line api getters and functions, in that
     12        the CommandLineAPIModuleSource.js calls a function with a callback.
     13
     14        * inspector/InjectedScriptSource.js:
     15        (InjectedScript.prototype.inspectObject):
     16        (InjectedScript.prototype.setInspectObject): Added.
     17        (InjectedScript.prototype._evaluateOn):
     18
    1192019-08-27  Mark Lam  <mark.lam@apple.com>
    220
  • trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js

    r249078 r249173  
    388388    }
    389389
    390     inspectObject(object)
    391     {
    392         if (this._inspectObject)
    393             this._inspectObject(object);
    394     }
    395 
    396390    releaseObject(objectId)
    397391    {
     
    419413
    420414    // CommandLineAPI
     415
     416    inspectObject(object)
     417    {
     418        if (this._inspectObject)
     419            this._inspectObject(object);
     420    }
     421
     422    setInspectObject(callback)
     423    {
     424        this._inspectObject = callback;
     425    }
    421426
    422427    addCommandLineAPIGetter(name, func)
     
    579584        let commandLineAPI = null;
    580585        if (includeCommandLineAPI)
    581             commandLineAPI = new InjectedScript.CommandLineAPI(isEvalOnCallFrame ? object : null)
     586            commandLineAPI = new InjectedScript.CommandLineAPI(isEvalOnCallFrame ? object : null);
    582587        return evalFunction.call(object, expression, commandLineAPI);
    583588    }
  • trunk/Source/WebCore/ChangeLog

    r249172 r249173  
     12019-08-27  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: don't attach properties to `injectedScript` for the CommandLineAPI
     4        https://bugs.webkit.org/show_bug.cgi?id=201193
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        For some reason, adding `injectedScript._inspectObject` inside CommandLineAPIModuleSource.js
     9        causes inspector/debugger/tail-deleted-frames-this-value.html to fail.
     10
     11        We should have a similar approach to adding command line api getters and functions, in that
     12        the CommandLineAPIModuleSource.js calls a function with a callback.
     13
     14        * inspector/CommandLineAPIModuleSource.js:
     15        (injectedScript._inspectObject): Deleted.
     16
    1172019-08-27  Zalan Bujtas  <zalan@apple.com>
    218
  • trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js

    r249078 r249173  
    3333// FIXME: <https://webkit.org/b/152294> Web Inspector: Parse InjectedScriptSource as a built-in to get guaranteed non-user-overridden built-ins
    3434
    35 injectedScript._inspectObject = function(object) {
     35injectedScript.setInspectObject(function(object) {
    3636    if (arguments.length === 0)
    3737        return;
    3838
    39     let objectId = RemoteObject.create(object, "");
     39    let objectId = RemoteObject.create(object);
    4040    let hints = {};
    4141
    4242    switch (RemoteObject.describe(object)) {
    4343    case "Database":
    44         let databaseId = CommandLineAPIHost.databaseId(object)
     44        var databaseId = CommandLineAPIHost.databaseId(object);
    4545        if (databaseId)
    4646            hints.databaseId = databaseId;
    4747        break;
    4848    case "Storage":
    49         let storageId = CommandLineAPIHost.storageId(object)
     49        var storageId = CommandLineAPIHost.storageId(object);
    5050        if (storageId)
    5151            hints.domStorageId = InjectedScriptHost.evaluate("(" + storageId + ")");
     
    5454
    5555    CommandLineAPIHost.inspect(objectId, hints);
    56     return object;
    57 };
     56});
    5857
    5958injectedScript.addCommandLineAPIGetter("0", function() {
Note: See TracChangeset for help on using the changeset viewer.