2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
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" />
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)");
23 contentWindow.mediaCount +=
1;
27 async function runTest() {
29 await checkForEventListenerLeaks(
"MediaQueryList", useMediaQuery);
37 SimpleTest.waitForExplicitFinish();
38 addEventListener(
"load", runTest, { once: true });