Skip to content
This repository has been 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
merged 1 commit into from
Mar 7, 2017

Conversation

JiaLiPassion
Copy link
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