Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

fix(xhr): fix #657, sometimes xhr will fire onreadystatechange with done twice#658

Merged
mhevery merged 1 commit intoangular:masterfrom
JiaLiPassion:xhr
Mar 7, 2017
Merged

fix(xhr): fix #657, sometimes xhr will fire onreadystatechange with done twice#658
mhevery merged 1 commit intoangular:masterfrom
JiaLiPassion:xhr

Conversation

@JiaLiPassion
Copy link
Copy Markdown
Collaborator

@JiaLiPassion JiaLiPassion commented Mar 3, 2017

Fix #657.

The similar issue can be found here,https://bugs.chromium.org/p/chromium/issues/detail?id=159827

And some times the XMLHttpRequest will fire onreadystatechange with readyState=4 multiple times.

xhr.onreadystatechange = function() {
                    if (xhr.readyState === 4) {
                        if (xhr['ok']) {
                            console.log('error duplicate done');
                        }
                        xhr['ok'] = true;
                    }
                }

this will cause ZoneTask to try to transit from notScheduled to running and cause error.
So I add a check to make sure ZoneTask is in scheduled state before running.

@mhevery mhevery merged commit bad4ad8 into angular:master Mar 7, 2017
mhevery pushed a commit that referenced this pull request Mar 7, 2017
mhevery pushed a commit that referenced this pull request Mar 7, 2017
mhevery pushed a commit that referenced this pull request Mar 7, 2017
mhevery pushed a commit that referenced this pull request Mar 7, 2017
mhevery pushed a commit that referenced this pull request Mar 7, 2017
mhevery pushed a commit that referenced this pull request Mar 7, 2017
@JiaLiPassion JiaLiPassion deleted the xhr branch March 17, 2017 03:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants