Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XMLHttpRequest isn't rooted while in flight #24

Open
toshok opened this issue Apr 1, 2014 · 0 comments
Open

XMLHttpRequest isn't rooted while in flight #24

toshok opened this issue Apr 1, 2014 · 0 comments

Comments

@toshok
Copy link
Owner

toshok commented Apr 1, 2014

osx-test/hello-osx.js has this block:

            this.xmlhttp = new XMLHttpRequest();
            this.xmlhttp.onreadystatechange = () => {
        console.log ("readyState == " + this.xmlhttp.readyState);
        if (this.xmlhttp.readyState === 4) {
                    console.log ("woohoo!");
            console.log (this.xmlhttp.responseText);
        }
            };
        console.log (this.xmlhttp.onreadystatechange);
            this.xmlhttp.open('GET', 'http://www.google.com/', true);
            this.xmlhttp.send();

'xmlhttp' should be a local variable, but if you make it one we crash, since the .send() doesn't cause it to be rooted by the GC. The GC frees it and we crash when attempting to call the onreadystatechange callback.

@toshok toshok added bug labels Apr 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant