summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/chrome/test_parsingMode.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/chrome/test_parsingMode.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/chrome/test_parsingMode.html')
-rw-r--r--dom/tests/mochitest/chrome/test_parsingMode.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/dom/tests/mochitest/chrome/test_parsingMode.html b/dom/tests/mochitest/chrome/test_parsingMode.html
new file mode 100644
index 000000000..011bded1d
--- /dev/null
+++ b/dom/tests/mochitest/chrome/test_parsingMode.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>CSSStyleSheet parsingMode test - bug 1230491</title>
+ <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+ function run() {
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
+
+ const sss = Cc["@mozilla.org/content/style-sheet-service;1"]
+ .getService(Ci.nsIStyleSheetService);
+ const domutils = Cc["@mozilla.org/inspector/dom-utils;1"]
+ .getService(Ci.inIDOMUtils);
+ const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+
+ const userUrl = encodeURI("data:text/css,body { color: seagreen; }");
+ utils.loadSheetUsingURIString(userUrl, sss.USER_SHEET);
+
+ const agentUrl = encodeURI("data:text/css,body { color: tomato; }");
+ utils.loadSheetUsingURIString(agentUrl, sss.AGENT_SHEET);
+
+ const authorUrl = "chrome://mochikit/content/tests/SimpleTest/test.css";
+
+ let results = [];
+ for (let sheet of domutils.getAllStyleSheets(document)) {
+ if (sheet.href === agentUrl) {
+ is(sheet.parsingMode, "agent", "agent sheet has expected mode");
+ results[sss.AGENT_SHEET] = 1;
+ } else if (sheet.href === userUrl) {
+ is(sheet.parsingMode, "user", "user sheet has expected mode");
+ results[sss.USER_SHEET] = 1;
+ } else if (sheet.href === authorUrl) {
+ is(sheet.parsingMode, "author",
+ "author sheet has expected mode");
+ results[sss.AUTHOR_SHEET] = 1;
+ } else if (sheet.href === "about:PreferenceStyleSheet") {
+ is(sheet.parsingMode, "agent",
+ "about:PreferenceStyleSheet has agent mode");
+ continue;
+ } else {
+ // Ignore sheets we don't care about.
+ continue;
+ }
+
+ // Check that re-parsing preserves the mode.
+ let mode = sheet.parsingMode;
+ domutils.parseStyleSheet(sheet, "body { color: chartreuse; }");
+ is(sheet.parsingMode, mode,
+ "check that re-parsing preserved mode " + mode);
+ }
+
+ ok(results[sss.AGENT_SHEET] && results[sss.USER_SHEET] &&
+ results[sss.AUTHOR_SHEET],
+ "all sheets seen");
+
+ SimpleTest.finish();
+ }
+</script>
+</head>
+<body onload="run()">
+ <div> What? </div>
+</body>
+</html>