fix(zone.js): should invoke xhr send task when no response error occurs#38836
Closed
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
Closed
fix(zone.js): should invoke xhr send task when no response error occurs#38836JiaLiPassion wants to merge 1 commit intoangular:masterfrom
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
Conversation
Close angular#38795 in the XMLHttpRequest patch, when get `readystatechange` event, zone.js try to invoke `load` event listener first, then call `invokeTask` to finish the `XMLHttpRequest::send` macroTask, but if the request failed because the server can not be reached, the `load` event listener will not be invoked, so the `invokeTask` of the `XMLHttpRequest::send` will not be triggered either, so we will have a non finished macroTask there which will make the Zone not stable, also memory leak. So in this PR, if the `XMLHttpRequest.status = 0` when we get the `readystatechange` event, that means something wents wrong before we reached the server, we need to invoke the task to finish the macroTask.
d365679 to
12f125a
Compare
mhevery
approved these changes
Sep 15, 2020
Contributor
Contributor
|
presubmit (previous run failed with unrelated build breakage) |
JoostK
approved these changes
Sep 18, 2020
Member
JoostK
left a comment
There was a problem hiding this comment.
LGTM. Thanks @JiaLiPassion for the fix! 🚀
mhevery
pushed a commit
that referenced
this pull request
Sep 18, 2020
…rs (#38836) Close #38795 in the XMLHttpRequest patch, when get `readystatechange` event, zone.js try to invoke `load` event listener first, then call `invokeTask` to finish the `XMLHttpRequest::send` macroTask, but if the request failed because the server can not be reached, the `load` event listener will not be invoked, so the `invokeTask` of the `XMLHttpRequest::send` will not be triggered either, so we will have a non finished macroTask there which will make the Zone not stable, also memory leak. So in this PR, if the `XMLHttpRequest.status = 0` when we get the `readystatechange` event, that means something wents wrong before we reached the server, we need to invoke the task to finish the macroTask. PR Close #38836
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #38795
in XMLHttpRequest patch, when get
readystatechangeevent, zone.js try toinvoke
loadevent listener first, then callinvokeTaskto finish theXMLHttpRequest::sendmacroTask, but if the request failed because theserver can not be reached, the
loadevent listener will not be invoked,so the
invokeTaskof theXMLHttpRequest::sendwill not be triggered either,so we will have a non finished macroTask there which will make the Zone
not stable, also memory leak.
So in this PR, if the
XMLHttpRequest.status = 0when we get thereadystatechangeevent, that means something wents wrong before we reached the server, we need to
invoke the task to finish the macroTask.