Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / layout / inspector / tests / test_get_all_style_sheets.html
blob906c4e9e086099379169b7d7129ddee75ce22455
1 <!DOCTYPE HTML>
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=734861
4 -->
5 <meta charset="utf-8">
6 <title>Test for Bug 734861</title>
7 <script src="/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
9 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=734861">Mozilla Bug 734861</a>
10 <div id="host"></div>
11 <script>
12 /** Test for Bug 734861 **/
13 const InspectorUtils = SpecialPowers.InspectorUtils;
15 add_task(async function() {
16 let sheet = new CSSStyleSheet();
17 await sheet.replace(`* { color: blue }`);
19 let host = document.querySelector("#host");
20 host.adoptedStyleSheets = [sheet, sheet];
21 document.adoptedStyleSheets.push(sheet);
23 let res = InspectorUtils.getAllStyleSheets(document);
25 let foundUA = false;
26 let adoptedCount = 0;
27 for (let s of InspectorUtils.getAllStyleSheets(document)) {
28 if (SpecialPowers.unwrap(s) == sheet) {
29 adoptedCount++;
31 if (s.href === "resource://gre-resources/ua.css") {
32 foundUA = true;
36 ok(foundUA, "UA sheet should be returned with all the other sheets.");
37 is(adoptedCount, 1, "Adopted stylesheet should show up once");
38 });
39 </script>