Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / test / test_mql_event_listener_leaks.html
blob3ceb5412a20082e86355e7906c64751f9973d474
1 <!--
2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
4 -->
5 <!DOCTYPE HTML>
6 <html>
7 <head>
8 <title>Bug 1450271 - Test MediaQueryList event listener leak conditions</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script type="text/javascript" src="/tests/dom/events/test/event_leak_utils.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
12 </head>
13 <body>
14 <script class="testbody" type="text/javascript">
15 // Manipulate MediaQueryList. Its important here that we create a
16 // listener callback from the DOM objects back to the frame's global
17 // in order to exercise the leak condition.
18 async function useMediaQuery(contentWindow) {
19 contentWindow.messageCount = 0;
21 let mql = contentWindow.matchMedia("(max-width: 600px)");
22 mql.onchange = _ => {
23 contentWindow.mediaCount += 1;
27 async function runTest() {
28 try {
29 await checkForEventListenerLeaks("MediaQueryList", useMediaQuery);
30 } catch (e) {
31 ok(false, e);
32 } finally {
33 SimpleTest.finish();
37 SimpleTest.waitForExplicitFinish();
38 addEventListener("load", runTest, { once: true });
39 </script>
40 </pre>
41 </body>
42 </html>