[Webkit-unassigned] [Bug 177353] Web Inspector: do not evaluate functions in the console unless requested

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 22 11:52:20 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=177353

Joseph Pecoraro <joepeck at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joepeck at webkit.org

--- Comment #1 from Joseph Pecoraro <joepeck at webkit.org> ---
I agree that `foo().|` shouldn't be enough to evaluate user functions that may cause side-effects.

I do also think that in the the common case this can / is useful:

    document.getElementById("header").|

Produces a list of properties on the element that it fetched.

We've had discussions in the past about side-effect versus no side-effect in autocompletion. It seems all tools are willing to invoke getters:

    Object.defineProperty(o, "x", {
        get() { console.log("GETTER"); }
    });

    js> o.x.asdf|
    GETTER // o.x.|
    GETTER // o.x.a|
    GETTER // o.x.as|
    GETTER // o.x.asd|
    GETTER // o.x.asdf|

But only some Safari invokes functions as you describe.

One thing we considered in the past was determining a list of functions that we would whitelist/blacklist to safely invoke if we know they do / don't have side-effects. For example:

    function is [native code]
    `document.query*`
    `document.get*`
    `Node.prototype.query*`
    `Node.prototype.get*`

But that list will likely be problematic to maintain. And as you point out, not all native functions starting with "get" are side-effect free so we really have to have some kind of list.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170922/2cb680fc/attachment.html>


More information about the webkit-unassigned mailing list