DescriptionFix XMLHttpRequest leak document when send() is called multiple times.
XMLHttpRequest creates a ThreadableLoader which may call XHR async, so it setPendingActivity() to avoid being destroyed. However, before this patch, unsetPendingActivity() was called asynchronously after ThreadableLoader was destroyed, so it lead to multiple problems:
a) When next m_loader was set in send() with pending unsetPendingActivity(), the pendingActivity may be dropped even when there exists new m_loader need protection.
b) pendingActivity may be set multiple times from pending unsetPendingActivity(), but dropProtectionSoon() only decrements m_pendingActivityCount by one, leading to a leak.
This patch fix the above problems by unsetPendingActivity() synchronously with m_loader destruction where possible. XMLHttpRequest::stop() still uses asynchronous unsetPendingActivity() to workaround issues mentioned in r152266.
The file "leak-check.js" was moved from fast/dom to fast/js to enable access from http tests.
BUG=270000
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=156078
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=156456
Patch Set 1 #
Total comments: 2
Patch Set 2 : try to sync unsetPendingActivity where possible #
Total comments: 4
Patch Set 3 : styles #
Total comments: 2
Patch Set 4 : use default argument #Patch Set 5 : omit default #Patch Set 6 : omit default args (somehow my changes are getting lost) #Patch Set 7 : unsetPendingActivity before changeState() #
Total comments: 2
Patch Set 8 : rebase #Patch Set 9 : retain unconditionally #Patch Set 10 : check readyState == 4 to comply with change made in r156212 #Messages
Total messages: 23 (0 generated)
|