[Webkit-unassigned] [Bug 90502] New: A variable created in the global scope does not cause a similarly-named property of the global object to be forced to "undefined"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 3 15:36:14 PDT 2012


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

           Summary: A variable created in the global scope does not cause
                    a similarly-named property of the global object to be
                    forced to "undefined"
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: imbcmdth at hotmail.com


Created an attachment (id=150681)
 --> (https://bugs.webkit.org/attachment.cgi?id=150681&action=review)
Shows the compatibility bug

For compatibility reasons, Firefox, Opera and Internet Explorer all force a variable defined in the global scope to hoist their "undefined" value into the global object and subsequently un-define (or hide) a global property with same name.

Attached example shows the problem. In all other browsers, (the exception being Safari and Chrome) the script will first print "undefined" and then print the number 42.

The reason for doing this in the name of compatibility is that new properties defined on the global object should never break existing scripts.

In WebKit browsers, if a script depends on the "undefined"-edness of a variable it will suddenly break if a property with that same name was added to the global object.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list