[Webkit-unassigned] [Bug 37935] New: JavaScript global variables get re-initialized with each function call.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 21 11:00:39 PDT 2010


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

           Summary: JavaScript global variables get re-initialized with
                    each function call.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: S60 Hardware
        OS/Version: S60 3rd edition
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: WebKit Qt
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: nokiabugz at gmail.com


When an external JavaScript file is included in an HTML file’s markup, any
global variables that are defined get set back to their original values.  For
example:


    var myCounter = 0;

    function incrementCounter() {
        return ++myCounter;
    }


Each time the incrementCounter function is called, the myCounter variable gets
reset to zero, so the function always returns 1.

This does NOT appear to happen with a small script such as the example above. 
The test case that is included DOES reproduce the error; it is unclear whether
this is due to the amount of memory used, or the use of the httpRequest object,
or something else entirely.

(The enclosed test loads a canned website into an iframe, waits 10 seconds,
then loads the next site from a list in sites.js.  Some debug output is
displayed in the textarea above the iframe.)

This is reproducable on the week 14 QtWebKit build.

-- 
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