-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(zone.js): should invoke xhr send task when no response error occurs #38836
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
presubmit (previous run failed with unrelated build breakage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @JiaLiPassion for the fix! 🚀
…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. |
Close #38795
in XMLHttpRequest patch, when get
readystatechange
event, zone.js try toinvoke
load
event listener first, then callinvokeTask
to finish theXMLHttpRequest::send
macroTask, but if the request failed because theserver can not be reached, the
load
event listener will not be invoked,so the
invokeTask
of theXMLHttpRequest::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 thereadystatechange
event, that means something wents wrong before we reached the server, we need to
invoke the task to finish the macroTask.