mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1450358
P2 Test AbortSignal for event listener related runtime leaks. r=baku
This commit is contained in:
parent
720c0d53fb
commit
0b6897561a
@ -2,6 +2,8 @@
|
||||
support-files =
|
||||
worker_abort_controller_fetch.js
|
||||
slow.sjs
|
||||
!/dom/events/test/event_leak_utils.js
|
||||
|
||||
[test_abort_controller.html]
|
||||
[test_abort_controller_fetch.html]
|
||||
[test_event_listener_leaks.html]
|
||||
|
43
dom/abort/tests/test_event_listener_leaks.html
Normal file
43
dom/abort/tests/test_event_listener_leaks.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1450271 - Test AbortSignal event listener leak conditions</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/dom/events/test/event_leak_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<script class="testbody" type="text/javascript">
|
||||
// Manipulate AbortSignal. Its important here that we create a
|
||||
// listener callback from the DOM objects back to the frame's global
|
||||
// in order to exercise the leak condition.
|
||||
async function useAbortSignal(contentWindow) {
|
||||
let controller = new contentWindow.AbortController();
|
||||
let signal = controller.signal;
|
||||
signal.onabort = _ => {
|
||||
contentWindow.abortCount += 1;
|
||||
};
|
||||
}
|
||||
|
||||
async function runTest() {
|
||||
try {
|
||||
await checkForEventListenerLeaks("AbortSignal", useAbortSignal);
|
||||
} catch (e) {
|
||||
ok(false, e);
|
||||
} finally {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addEventListener("load", runTest, { once: true });
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user