3 <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=524223 -->
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
}
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
}
32 href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=524223">Mozilla
39 <ol><li>text/css
<ol><li>same origin
<ol><li>valid
</li>
41 <li>http error
</li></ol></li>
42 <li>cross origin
<ol><li>valid
</li>
44 <li>http error
</li></ol></li>
45 <li>same to cross
<ol><li>valid
</li>
47 <li>http error
</li></ol></li>
48 <li>cross to same
<ol><li>valid
</li>
50 <li>http error
</li></ol></li></ol></li>
51 <li>text/html
<ol><li>same origin
<ol><li>valid
</li>
53 <li>http error
</li></ol></li>
54 <li>cross origin
<ol><li>valid
</li>
56 <li>http error
</li></ol></li>
57 <li>same to cross
<ol><li>valid
</li>
59 <li>http error
</li></ol></li>
60 <li>cross to same
<ol><li>valid
</li>
62 <li>http error
</li></ol></li></ol></li>
68 <div id=
"quirks-placeholder"></div>
73 <div id=
"standards-placeholder"></div>
76 <script type=
"application/javascript">
78 const COLOR = {red:
"rgb(255, 0, 0)", lime:
"rgb(0, 255, 0)"};
80 // Cross origin requests with text/html as the contentType.
81 // These requests will be blocked by ORB (when ORB is enabled),
82 // thus the color of the element is not going to be changed.
83 const BLOCKED_BY_ORB = [
"JD1i",
"JD1l",
"JD2i",
"JD2l"];
85 /** Test for Bug
524223 **/
86 function check_iframe(ifr) {
87 var doc = ifr.contentDocument;
88 var cases = doc.getElementsByTagName(
"p");
90 for (var i =
0; i < cases.length; i++) {
91 var color = doc.defaultView.getComputedStyle(cases[i])
92 .getPropertyValue(
"background-color");
95 // only 'quirks' can have requests that are blocked by ORB.
96 if (BLOCKED_BY_ORB.includes(id) && ifr.id ===
"quirks") {
97 is(color, COLOR.red, ifr.id +
" " + id);
99 is(color, COLOR.lime, ifr.id +
" " + id);
104 SimpleTest.waitForExplicitFinish();
106 function insertIFrames(src, id) {
107 const quirks = document.createElement(
"iframe");
108 quirks.src =
"ccd-quirks.html";
109 quirks.id =
"quirks";
110 document.getElementById(
"quirks-placeholder").replaceWith(quirks);
112 const standards = document.createElement(
"iframe");
113 standards.src =
"ccd-standards.html";
114 standards.id =
"standards";
115 document.getElementById(
"standards-placeholder").replaceWith(standards);
118 var hasQuirksLoaded = false;
119 var hasStandardsLoaded = false;
121 function quirksLoaded() {
122 hasQuirksLoaded = true;
126 function standardsLoaded() {
127 hasStandardsLoaded = true;
132 check_iframe(document.getElementById(
"quirks"));
133 check_iframe(document.getElementById(
"standards"));
136 function MaybeRunTest() {
137 if (!hasQuirksLoaded || !hasStandardsLoaded) {
145 window.onload = async function() {
146 await SpecialPowers.pushPrefEnv(
149 ['browser.opaqueResponseBlocking', true],
150 ['browser.opaqueResponseBlocking.javascriptValidator', true],