layout/style/test/test_mql_event_listener_leaks.html
author Emilio Cobos Álvarez <emilio@crisal.io>
Fri, 24 Sep 2021 05:45:33 +0000
changeset 593121 64bfebfc3f6c63388d8a27b2a0c91020dc859666
parent 469640 c9c0c6f2eed54a187e124942e53c3660b4cf17d8
permissions -rw-r--r--
Bug 1732267 - Make textarea::placeholder honor white-space. r=layout-reviewers,jfkthame This comes from https://hg.mozilla.org/mozilla-central/rev/0f28fd24bdf3, and was done because of implementation limitations which don't apply anymore (https://bugzilla.mozilla.org/show_bug.cgi?id=737786#c33): * white-space changes don't reframe anymore, they only reflow. * We fixed reframing of native-anonymous content to do the right thing. This aligns <textarea> and <input>, so I think it should be uncontroversial. See https://github.com/w3c/csswg-drafts/issues/6669 for the discussion that prompted this. Differential Revision: https://phabricator.services.mozilla.com/D126471

<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
  <title>Bug 1450271 - Test MediaQueryList event listener leak conditions</title>
  <script 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>
<script class="testbody" type="text/javascript">
// Manipulate MediaQueryList.  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 useMediaQuery(contentWindow) {
  contentWindow.messageCount = 0;

  let mql = contentWindow.matchMedia("(max-width: 600px)");
  mql.onchange = _ => {
    contentWindow.mediaCount += 1;
  };
}

async function runTest() {
  try {
    await checkForEventListenerLeaks("MediaQueryList", useMediaQuery);
  } catch (e) {
    ok(false, e);
  } finally {
    SimpleTest.finish();
  }
}

SimpleTest.waitForExplicitFinish();
addEventListener("load", runTest, { once: true });
</script>
</pre>
</body>
</html>