author Sandor Molnar <>
Thu, 16 Sep 2021 18:58:41 +0300
changeset 592155 d952541c136fa93474dc3f3d76f4afcd86100f2e
parent 415791 b0741467f091642d4789857bdb27570e1591f931
permissions -rw-r--r--
Merge autoland to mozilla-central. a=merge

<!doctype html>
<!-- -->
<title>Test for Bug 1386840: non-matching media list doesn't block rendering</title>
<link rel="author" title="Emilio Cobos Álvarez" href="">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
var t = async_test("Test that <link> doesn't block rendering with non-matching media");
var loadFired = false;
var scriptExecuted = false;

function sheetLoaded() {
  loadFired = true;
  assert_true(scriptExecuted, "Shouldn't wait for load to execute script");
  NOTE(emilio): This can theoretically race if an HTTP packet boundary with a
  very long delay came right after the link and before the script.  If this
  ever becomes a problem, the way to fix this is using document.write() as
  explained in bug 1386840 comment 12.
<link rel="stylesheet" href="data:text/css,foo {}" media="print" onload="t.step(sheetLoaded)">
  t.step(function() {
    scriptExecuted = true;
    assert_false(loadFired, "Shouldn't have waited for load");