Bug 1390455 - regression test for CSS rule columns; r=gl,jryans
authorTom Tromey <tom@tromey.com>
Tue, 05 Sep 2017 11:39:45 -0600
changeset 660381 53286dcc59e9455e53222cc49ae13883982d6224
parent 660380 f9c03c26c8763e78a2c70f1afc6cfb0fc92ec493
child 660382 3f4037fca66795fda968e20fb2b164320f5a357b
push id78390
push userbmo:emilio@crisal.io
push dateWed, 06 Sep 2017 23:04:15 +0000
reviewersgl, jryans
bugs1390455
milestone57.0a1
Bug 1390455 - regression test for CSS rule columns; r=gl,jryans This adds an integration test for the CSS rule column issue from bug 1390455. The fix was landed in upstream rust-cssparser. MozReview-Commit-ID: 34rLhe3BCqx
devtools/client/inspector/rules/test/browser.ini
devtools/client/inspector/rules/test/browser_rules_non_ascii.js
--- a/devtools/client/inspector/rules/test/browser.ini
+++ b/devtools/client/inspector/rules/test/browser.ini
@@ -193,16 +193,17 @@ skip-if = (os == "win" && debug) # bug 9
 [browser_rules_mathml-element.js]
 [browser_rules_media-queries.js]
 [browser_rules_multiple-properties-duplicates.js]
 [browser_rules_multiple-properties-priority.js]
 [browser_rules_multiple-properties-unfinished_01.js]
 [browser_rules_multiple-properties-unfinished_02.js]
 [browser_rules_multiple_properties_01.js]
 [browser_rules_multiple_properties_02.js]
+[browser_rules_non_ascii.js]
 [browser_rules_original-source-link.js]
 [browser_rules_original-source-link2.js]
 [browser_rules_pseudo-element_01.js]
 [browser_rules_pseudo-element_02.js]
 [browser_rules_pseudo_lock_options.js]
 [browser_rules_refresh-no-flicker.js]
 [browser_rules_refresh-on-attribute-change_01.js]
 [browser_rules_refresh-on-attribute-change_02.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/rules/test/browser_rules_non_ascii.js
@@ -0,0 +1,37 @@
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test that rule view can open when there are non-ASCII characters in
+// the style sheet.  Regression test for bug 1390455.
+
+// Use a few 4-byte UTF-8 sequences to make it so the rule column
+// would be wrong when we had the bug.
+const SHEET_TEXT = "/*🆒🆒🆒🆒🆒🆒🆒🆒🆒🆒🆒🆒🆒🆒🆒*/#q{color:orange}";
+const HTML = `<style type="text/css">\n${SHEET_TEXT}
+              </style><div id="q">Styled Node</div>`;
+const TEST_URI = "data:text/html;charset=utf-8," + encodeURIComponent(HTML);
+
+add_task(async function () {
+  await addTab(TEST_URI);
+
+  let {inspector, view} = await openRuleView();
+  await selectNode("#q", inspector);
+
+  let elementStyle = view._elementStyle;
+
+  let expected = [
+    {name: "color", overridden: false},
+  ];
+
+  let rule = elementStyle.rules[1];
+
+  for (let i = 0; i < expected.length; ++i) {
+    let prop = rule.textProps[i];
+    is(prop.name, expected[i].name, `Got expected property name ${prop.name}`);
+    is(prop.overridden, expected[i].overridden,
+       `Got expected overridden value ${prop.overridden}`);
+  }
+});