Make TimeoutManager::SetTimeout no-op if window is dying

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1771009
gecko-commit: 1b5a961e54069b7e66979d78b28e0a9beb8d4de9
gecko-reviewers: smaug
diff --git a/dom/abort/crashtests/timeout-close.html b/dom/abort/crashtests/timeout-close.html
new file mode 100644
index 0000000..ee8544a
--- /dev/null
+++ b/dom/abort/crashtests/timeout-close.html
@@ -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>
diff --git a/lint.ignore b/lint.ignore
index e6e755b..fdba97d 100644
--- a/lint.ignore
+++ b/lint.ignore
@@ -341,6 +341,7 @@
 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