mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1771009 - Make TimeoutManager::SetTimeout no-op if window is dying r=smaug
setTimeout is not affected since nsGlobalWindowInner::SetTimeout is not called at all when it's dying, but that's not the case with AbortSignal.timout, so we have to explicitly deal with such situation. Differential Revision: https://phabricator.services.mozilla.com/D147368
This commit is contained in:
parent
999f79eca9
commit
490bd934d0
@ -465,7 +465,7 @@ nsresult TimeoutManager::SetTimeout(TimeoutHandler* aHandler, int32_t interval,
|
||||
// If we don't have a document (we could have been unloaded since
|
||||
// the call to setTimeout was made), do nothing.
|
||||
nsCOMPtr<Document> doc = mWindow.GetExtantDoc();
|
||||
if (!doc) {
|
||||
if (!doc || mWindow.IsDying()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="test-wait">
|
||||
<meta charset="utf-8">
|
||||
<iframe id="iframe"></iframe>
|
||||
<script>
|
||||
const srcdoc = `
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
const xhr = new XMLHttpRequest()
|
||||
setTimeout(() => {
|
||||
xhr.open('GET', '/', false)
|
||||
xhr.send()
|
||||
AbortSignal.timeout(41.62684667994843)
|
||||
}, 1)
|
||||
setTimeout(() => {
|
||||
location.href = "about:blank"
|
||||
parent.document.documentElement.classList.remove("test-wait")
|
||||
}, 0)
|
||||
</` + "script>";
|
||||
iframe.srcdoc = srcdoc;
|
||||
</script>
|
@ -341,6 +341,7 @@ SET TIMEOUT: speculation-rules/prerender/resources/prerender-response-code.html
|
||||
SET TIMEOUT: speculation-rules/prerender/resources/deferred-promise-utils.js
|
||||
SET TIMEOUT: speculation-rules/prerender/resources/utils.js
|
||||
SET TIMEOUT: html/browsers/browsing-the-web/back-forward-cache/timers.html
|
||||
SET TIMEOUT: dom/abort/crashtests/timeout-close.html
|
||||
|
||||
# setTimeout use in reftests
|
||||
SET TIMEOUT: acid/acid3/test.html
|
||||
|
Loading…
Reference in New Issue
Block a user