blob: 46d12d33fca755a24278f64fb73ee30cb1ca2e5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(function* () {
let target = TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = yield gDevTools.showToolbox(target);
let doc = toolbox.doc;
let root = doc.documentElement;
let platform = root.getAttribute("platform");
let expectedPlatform = getPlatform();
is(platform, expectedPlatform, ":root[platform] is correct");
let theme = Services.prefs.getCharPref("devtools.theme");
let className = "theme-" + theme;
ok(root.classList.contains(className),
":root has " + className + " class (current theme)");
// Convert the xpath result into an array of strings
// like `href="{URL}" type="text/css"`
let sheetsIterator = doc.evaluate("processing-instruction('xml-stylesheet')",
doc, null, XPathResult.ANY_TYPE, null);
let sheetsInDOM = [];
/* eslint-disable no-cond-assign */
let sheet;
while (sheet = sheetsIterator.iterateNext()) {
sheetsInDOM.push(sheet.data);
}
/* eslint-enable no-cond-assign */
let sheetsFromTheme = gDevTools.getThemeDefinition(theme).stylesheets;
info("Checking for existence of " + sheetsInDOM.length + " sheets");
for (let themeSheet of sheetsFromTheme) {
ok(sheetsInDOM.some(s => s.includes(themeSheet)),
"There is a stylesheet for " + themeSheet);
}
yield toolbox.destroy();
});
function getPlatform() {
let {OS} = Services.appinfo;
if (OS == "WINNT") {
return "win";
} else if (OS == "Darwin") {
return "mac";
}
return "linux";
}
|