preload-link-cached-stylesheet-different-doc.html (1004B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1646776"> 4 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 5 <link rel="author" href="https://mozilla.org" title="Mozilla"> 6 <link rel="stylesheet" href="data:text/css,:root{background:green}"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <body> 10 <script> 11 // Note that script execution waits for the stylesheet above to be loaded. 12 window.t = async_test("Stylesheets that are already loaded in the document don't cause spurious error events on preloads"); 13 let subdoc = document.createElement("iframe"); 14 subdoc.srcdoc = ` 15 <!doctype html> 16 <meta charset="utf-8"> 17 <link rel="preload" as="style" href="data:text/css,:root{background:green}" onload="parent.t.done()" onerror="parent.t.step(() => parent.assert_unreached('should not error'))"> 18 `; 19 document.body.appendChild(subdoc); 20 </script>