tor-browser

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

test_css_cross_domain_no_orb.html (4232B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=524223 -->
      4 <head>
      5  <title>Test cross-domain CSS loading</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css"
      8        href="/tests/SimpleTest/test.css"/>
      9  <style type="text/css">
     10    hr { border: none; clear: both }
     11    .column {
     12        margin: 10px;
     13        float: left;
     14    }
     15    iframe {
     16        width: 40px;
     17        height: 680px;
     18        border: none;
     19        margin: 0;
     20        padding: 0;
     21    }
     22    h2 { font-weight: normal; padding: 0 }
     23    ol, h2 { font-size: 13px; line-height: 20px; }
     24    ol { padding-left: 1em;
     25         list-style-type: upper-roman }
     26    ol ol { list-style-type: upper-alpha }
     27    ol ol ol { list-style-type: decimal }
     28  </style>
     29 </head>
     30 <body>
     31 <a target="_blank"
     32   href="https://bugzilla.mozilla.org/show_bug.cgi?id=524223">Mozilla
     33   Bug 524223</a>
     34 
     35 <hr/>
     36 
     37 <div class="column">
     38 <h2>&nbsp;</h2>
     39 <ol><li>text/css<ol><li>same origin<ol><li>valid</li>
     40                                       <li>malformed</li>
     41                                       <li>http error</li></ol></li>
     42                  <li>cross origin<ol><li>valid</li>
     43                                      <li>malformed</li>
     44                                      <li>http error</li></ol></li>
     45                  <li>same to cross<ol><li>valid</li>
     46                                       <li>malformed</li>
     47                                       <li>http error</li></ol></li>
     48                  <li>cross to same<ol><li>valid</li>
     49                                       <li>malformed</li>
     50                                       <li>http error</li></ol></li></ol></li>
     51    <li>text/html<ol><li>same origin<ol><li>valid</li>
     52                                        <li>malformed</li>
     53                                        <li>http error</li></ol></li>
     54                     <li>cross origin<ol><li>valid</li>
     55                                         <li>malformed</li>
     56                                         <li>http error</li></ol></li>
     57                     <li>same to cross<ol><li>valid</li>
     58                                          <li>malformed</li>
     59                                          <li>http error</li></ol></li>
     60                     <li>cross to same<ol><li>valid</li>
     61                                          <li>malformed</li>
     62                                          <li>http error</li></ol></li></ol></li>
     63 </ol>
     64 </div>
     65 
     66 <div class="column">
     67 <h2>Quirks</h2>
     68 <div id="quirks-placeholder"></div>
     69 </div>
     70 
     71 <div class="column">
     72 <h2>Standards</h2>
     73 <div id="standards-placeholder"></div>
     74 </div>
     75 
     76 <script type="application/javascript">
     77 
     78 const COLOR = {red: "rgb(255, 0, 0)", lime: "rgb(0, 255, 0)"};
     79 
     80 /** Test for Bug 524223 */
     81 function check_iframe(ifr) {
     82  var doc = ifr.contentDocument;
     83  var cases = doc.getElementsByTagName("p");
     84 
     85  for (var i = 0; i < cases.length; i++) {
     86   var color = doc.defaultView.getComputedStyle(cases[i])
     87        .getPropertyValue("background-color");
     88 
     89    var id = cases[i].id;
     90   is(color, COLOR.lime, ifr.id + " " + id);
     91  }
     92 }
     93 
     94 SimpleTest.waitForExplicitFinish();
     95 
     96 function insertIFrames(src, id) {
     97  const quirks = document.createElement("iframe");
     98  quirks.src = "ccd-quirks.html";
     99  quirks.id = "quirks";
    100  document.getElementById("quirks-placeholder").replaceWith(quirks);
    101 
    102  const standards = document.createElement("iframe");
    103  standards.src = "ccd-standards.html";
    104  standards.id = "standards";
    105  document.getElementById("standards-placeholder").replaceWith(standards);
    106 }
    107 
    108 var hasQuirksLoaded = false;
    109 var hasStandardsLoaded = false;
    110 
    111 function quirksLoaded() {
    112  hasQuirksLoaded = true;
    113  MaybeRunTest();
    114 }
    115 
    116 function standardsLoaded() {
    117  hasStandardsLoaded = true;
    118  MaybeRunTest();
    119 }
    120 
    121 function runTest() {
    122  check_iframe(document.getElementById("quirks"));
    123  check_iframe(document.getElementById("standards"));
    124 }
    125 
    126 function MaybeRunTest() {
    127  if (!hasQuirksLoaded || !hasStandardsLoaded) {
    128      return;
    129  }
    130 
    131  runTest();
    132  SimpleTest.finish();
    133 }
    134 
    135 window.onload = async function() {
    136  await SpecialPowers.pushPrefEnv(
    137    {
    138      set: [
    139        ['browser.opaqueResponseBlocking', false],
    140      ],
    141    }
    142  );
    143  insertIFrames();
    144 };
    145 </script>
    146 </body>
    147 </html>