[Webkit-unassigned] [Bug 183087] Safari not handling undefined global variables with same name as element Id correctly.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 7 12:53:18 PST 2018


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

--- Comment #10 from Chris Dumez <cdumez at apple.com> ---
(In reply to Chris Dumez from comment #9)
> (In reply to Chris Dumez from comment #8)
> > (In reply to Keith Miller from comment #7)
> > > Without looking closer I would guess this is because of the way that
> > > JSGlobalObject does getOwnPropertySlot and addGlobalVariable. If you define
> > > a variable it won't clear the existing global property, which I assume is
> > > the '<div id="someElement"></div>'. And when you do a getOwnPropertySlot on
> > > the global object it will see the old global property instead of shadowing.
> > > This is just a hunch, I can debug it more thoroughly later.
> > 
> > This would be great, thanks Keith.
> 
> FYI, I do not see JSGlobalObject::addGlobalVar(const Identifier&) called.
> Therefore, JSGlobalObject::getOwnPropertySlot() is not able to find the
> variable in the symbol table.

I see now. JSGlobalObject::addVar() gets called but it is implemented like so:
void addVar(ExecState* exec, const Identifier& propertyName)
    {
        if (!hasProperty(exec, propertyName))
            addGlobalVar(propertyName);
    }

hasProperty() returns true here (because of named property) so we do not call addGlobalVar().

-- 
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/20180307/9ad36c76/attachment-0001.html>


More information about the webkit-unassigned mailing list