Bug 1380082 - Don't Stylo check pref directly in tests. r=xidorn draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Wed, 12 Jul 2017 13:03:15 -0500
changeset 607857 ffef92eec90785e6161c2caee206220a9b0f0564
parent 607856 5a313dc6e444a1b4de203e12729e510720eb334b
child 637163 c2a88ea97ee1a38b2a7474cd61533ccb2f9040e3
push id68126
push userbmo:jryans@gmail.com
push dateWed, 12 Jul 2017 23:00:32 +0000
reviewersxidorn
bugs1380082
milestone56.0a1
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