Bug 1380082 - Don't Stylo check pref directly in tests. r=xidorn
authorJ. Ryan Stinnett <jryans@gmail.com>
Wed, 12 Jul 2017 13:03:15 -0500
changeset 368953 8b7a40e98c28abb637af78daf0a85de7d7461a81
parent 368952 9bdcd7d00ed647bb23ebdc2c7a6e7db78865f857
child 368954 b08d78d02da1e1c78cb6935f4e570798cb088ddd
push id32178
push userkwierso@gmail.com
push dateSat, 15 Jul 2017 00:10:05 +0000
treeherdermozilla-central@9ce83907a2bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1380082
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1380082 - Don't Stylo check pref directly in tests. r=xidorn Stylo might be enabled by either env var or pref. Use the existing DOMWindowUtils method to test for Stylo instead of the pref to get an accurate value. MozReview-Commit-ID: 8p22xCBjHjo
devtools/server/tests/mochitest/test_inspector-anonymous.html
layout/style/test/animation_utils.js
layout/style/test/test_bug413958.html
layout/style/test/test_keyframes_vendor_prefix.html
layout/style/test/test_parser_diagnostics_unprintables.html
--- a/devtools/server/tests/mochitest/test_inspector-anonymous.html
+++ b/devtools/server/tests/mochitest/test_inspector-anonymous.html
@@ -17,17 +17,17 @@ window.onload = function () {
   const {InspectorFront} =
     require("devtools/shared/fronts/inspector");
   const {_documentWalker} =
     require("devtools/server/actors/inspector");
   const nodeFilterConstants =
     require("devtools/shared/dom-node-filter-constants");
   const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
-  const isStylo = SpecialPowers.getBoolPref("layout.css.servo.enabled", false);
+  const isStylo = SpecialPowers.DOMWindowUtils.isStyledByServo;
 
   SpecialPowers.pushPrefEnv({"set": [
     ["dom.webcomponents.enabled", true]
   ]});
   SimpleTest.waitForExplicitFinish();
 
   let gWalker = null;
   let gInspectee = null;
--- a/layout/style/test/animation_utils.js
+++ b/layout/style/test/animation_utils.js
@@ -407,18 +407,18 @@ const ExpectComparisonTo = {
 };
 
 // FIXME: Bug 1340005: We use |RawServoAnimationValue| on the main thread if
 // enabling Servo style backend, and still use |StyleAnimationValue| on the
 // compositor thread. |RawServoAnimationValue| rounds the interpolated results
 // to a nearest |app_units::Au| (i.e. i32), so we might have a tiny difference
 // between the results from getOMTAStyle() and getComputedStyle().
 // Note: 1 AU ~= 60 CSS pixel unit.
-const isServo = SpecialPowers.getBoolPref("layout.css.servo.enabled", false);
-const toleranceForServoBackend = isServo ? 0.5 / 60.0 : 0.0;
+const isStylo = SpecialPowers.DOMWindowUtils.isStyledByServo;
+const toleranceForServoBackend = isStylo ? 0.5 / 60.0 : 0.0;
 
 (function() {
   window.omta_todo_is = function(elem, property, expected, runningOn, desc,
                                  pseudo) {
     return omta_is_approx(elem, property, expected, 0, runningOn, desc,
                           ExpectComparisonTo.Fail, pseudo);
   };
 
--- a/layout/style/test/test_bug413958.html
+++ b/layout/style/test/test_bug413958.html
@@ -34,17 +34,17 @@ var tests = [
             .setAttribute("style", "width:200;color:black");
   },
   function() {
     var s = document.getElementById("setStyleProp").style;
     s.width = "200";
     s.color = "black";
   },
 ];
-const isStylo = SpecialPowers.getBoolPref('layout.css.servo.enabled', false);
+const isStylo = SpecialPowers.DOMWindowUtils.isStyledByServo;
 var results = [
   [ { errorMessage: /Unknown property \u2018nosuchprop\u2019/,
       lineNumber: 1, columnNumber: isStylo ? 4 : 14,
       sourceLine: "#s1{nosuchprop:auto; color:black}" },
     { errorMessage: /Unknown property \u2018nosuchprop\u2019/,
       lineNumber: 2, columnNumber: isStylo ? 4 : 14, sourceLine:
       "#s2{nosuchprop:auto; color:black}invalid?sel{}#s3{color:black}" },
     { errorMessage: /Ruleset ignored due to bad selector/,
--- a/layout/style/test/test_keyframes_vendor_prefix.html
+++ b/layout/style/test/test_keyframes_vendor_prefix.html
@@ -57,17 +57,17 @@ function addDiv(t, attrs) {
   if (t && typeof t.add_cleanup === 'function') {
     t.add_cleanup(function() {
       div.remove();
     });
   }
   return div;
 }
 
-const isStylo = SpecialPowers.getBoolPref('layout.css.servo.enabled', false);
+const isStylo = SpecialPowers.DOMWindowUtils.isStyledByServo;
 
 test(function(t) {
   addStyle(t,
     { '@-webkit-keyframes anim': 'from,to { color: rgb(0, 255, 0); }' });
 
   var div = addDiv(t, { style: 'animation: anim 100s' });
 
   assert_equals(getComputedStyle(div).color, 'rgb(0, 255, 0)');
--- a/layout/style/test/test_parser_diagnostics_unprintables.html
+++ b/layout/style/test/test_parser_diagnostics_unprintables.html
@@ -39,17 +39,17 @@ let patterns = [
   // _AtKeyword
   { i: "x{@<t>: }",        o: "declaration but found \u2018@<i>\u2019." },
   // _String
   { i: "x{ '<t>'}" ,       o: "declaration but found \u2018'<s>'\u2019." },
   // _Bad_String
   { i: "x{ '<t>\n}",      o: "declaration but found \u2018'<s>\u2019." },
 ];
 
-const isStylo = SpecialPowers.getBoolPref('layout.css.servo.enabled', false);
+const isStylo = SpecialPowers.DOMWindowUtils.isStyledByServo;
 
 // Stylo's CSS parser only reports the 'url(' token, not the actual bad URL.
 if (!isStylo) {
   patterns.push(
     // _URL
     { i: "x{ url('<t>')}",   o: "declaration but found \u2018url('<s>')\u2019." })
   patterns.push(
     // _Bad_URL