tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

resource_timing_nocors.html (3194B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 
      6 <!DOCTYPE html>
      7 <html>
      8 <head>
      9  <link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/SimpleTest/test.css"/>
     10  <link rel="stylesheet" type="text/css" href="http://mochi.test:8888/tests/dom/tests/mochitest/general/linkA.css"/>
     11  <link rel="stylesheet" type="text/css" href="http://example.com/tests/dom/tests/mochitest/general/linkB.css"/>
     12  <link rel="stylesheet" type="text/css" href="http://example.net/tests/dom/tests/mochitest/general/linkC.css"/>
     13 
     14 <!--
     15 
     16  Resources fetched by a cross-origin stylesheet loaded with a no-cors mode should not be reported.
     17  Resources marked with a ^ should be reported in performance.getEntries()
     18 
     19  (mochi.test:8888 | linkA.css)^ -> (mochi.test:8888 | cssA.css)^
     20                                 -> (mochi.test:8888 | cssB.css)^ -> (mochi.test:8888 | cssC.css)^
     21                                                                  -> (example.org     | cssC.css)^
     22  (example.com     | linkB.css)^ -> (example.com     | cssA.css)
     23                                 -> (mochi.test:8888 | cssA.css)
     24                                 -> (test2.examp.org | cssB.css) -> (test2.examp.org | cssC.css)
     25                                                                 -> (example.org     | cssC.css)
     26                                 -> (example.net     | cssC.css)
     27 
     28  (example.net     | linkC.css)^ -> (example.net | cssA.css)
     29    [WITH Allow-* HEADERS]
     30 
     31 -->
     32 
     33 
     34  <script type="application/javascript">
     35 
     36 function ok(cond, message) {
     37  window.opener.ok(cond, message)
     38 }
     39 
     40 function is(received, expected, message) {
     41  window.opener.is(received, expected, message);
     42 }
     43 
     44 function isnot(received, notExpected, message) {
     45  window.opener.isnot(received, notExpected, message);
     46 }
     47 
     48 var allResources = {
     49  "http://mochi.test:8888/tests/SimpleTest/test.css" : "link",
     50  "http://mochi.test:8888/tests/dom/tests/mochitest/general/linkA.css" : "link",
     51  "http://example.com/tests/dom/tests/mochitest/general/linkB.css" : "link",
     52  "http://example.net/tests/dom/tests/mochitest/general/linkC.css" : "link",
     53  "http://mochi.test:8888/tests/dom/tests/mochitest/general/cssA.css" : "css",
     54  "http://mochi.test:8888/tests/dom/tests/mochitest/general/cssB.css" : "css",
     55  "http://mochi.test:8888/tests/dom/tests/mochitest/general/cssC.css" : "css",
     56  "http://example.org/tests/dom/tests/mochitest/general/cssC.css" : "css",
     57 };
     58 
     59 window.onload = function() {
     60  let entries = performance.getEntries();
     61  for (let entry of entries) {
     62    let type = allResources[entry.name];
     63    if (!type) {
     64      ok(false, "Did not expect to find resource: "+entry.name);
     65      continue;
     66    }
     67 
     68    is(entry.initiatorType, type, "Expected initiatorType does not match");
     69  }
     70 
     71  is(entries.length, Object.keys(allResources).length, "Found wrong number of resources");
     72 
     73  window.opener.finishTests();
     74 }
     75 
     76 </script>
     77 </head>
     78 <body>
     79  <a target="_blank"
     80     href="https://bugzilla.mozilla.org/show_bug.cgi?id=1180145"
     81     title="Resource timing NO-CORS CSS">
     82    Bug #1180145 -  Resource Timing NO-CORS CSS
     83  </a>
     84  <p id="display"></p>
     85  <div id="content">
     86  </div>
     87 </body>
     88 </html>