Fix the issue where resource silently fails to load #9119
Merged
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.
Fixes #9093
When
request.deferred.resolve(result)
get called in the functionRequestScheduler.getRequestReceivedFunction()
, the callback can potentially create a newdeferred
object and assign it to the existingrequest
. But after theresolve()
above is executed, therequest.deferred
is assigned toundefined
, which accidentally removes the newly createddeferred
object. So the second call ofRequestScheduler.getRequestReceivedFunction()
for the same request will lead to error ofrequest.undefined.resolve(result)
.For the fix, I save the old deferred object first, then modify the state of request, and call the
resolve()
at the end. The fix is similar to the cancel function just in case it can have the same potential problem@lilleyse Can you please take a look at it? Please let me know if I should add anything