Bug 1341927. Fix the stylo reftest setup to set prefs via the normal mechanism and hence not run afoul of the reftest harness canvas caching. r?heycam draft
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 22 Feb 2017 19:30:57 -0500
changeset 488322 871ac134fe01fb7c3f4073c648b89d6e47d8bfbc
parent 488074 b06968288cff469814bf830aa90f1c84da490f61
child 546700 714811d53f97c75665ba3535b42c09e7a7a68ed4
push id46494
push userbzbarsky@mozilla.com
push dateThu, 23 Feb 2017 00:32:35 +0000
reviewersheycam
bugs1341927
milestone54.0a1
Bug 1341927. Fix the stylo reftest setup to set prefs via the normal mechanism and hence not run afoul of the reftest harness canvas caching. r?heycam MozReview-Commit-ID: 9XlVwTV964w
layout/reftests/writing-mode/tables/reftest-stylo.list
layout/tools/reftest/reftest.jsm
--- a/layout/reftests/writing-mode/tables/reftest-stylo.list
+++ b/layout/reftests/writing-mode/tables/reftest-stylo.list
@@ -66,18 +66,18 @@ asserts(1-2) == vertical-table-specified
 
 # HTTP(../..) == s72-border-spacing-002.xht s72-border-spacing-002.xht
 # HTTP(../..) == s72-border-spacing-003.xht s72-border-spacing-003.xht
 # HTTP(../..) == s72-border-spacing-004.xht s72-border-spacing-004.xht
 # HTTP(../..) == s72-border-spacing-005.xht s72-border-spacing-005.xht
 fails == wm-row-progression-002.xht wm-row-progression-002.xht
 fails == wm-row-progression-003.xht wm-row-progression-003.xht
 fails == wm-row-progression-004.xht wm-row-progression-004.xht
-== wm-row-progression-004.xht wm-row-progression-005.xht
-== wm-row-progression-004.xht wm-row-progression-006.xht
+fails == wm-row-progression-005.xht wm-row-progression-005.xht
+fails == wm-row-progression-006.xht wm-row-progression-006.xht
 fails == wm-row-progression-007.xht wm-row-progression-007.xht
 
 # == table-caption-top-1.html table-caption-top-1.html
 # == table-caption-bottom-1.html table-caption-bottom-1.html
 # == table-caption-left-1.html table-caption-left-1.html
 # == table-caption-right-1.html table-caption-right-1.html
 
 fuzzy-if(stylo,1,7400) == border-collapse-bevels-1a.html border-collapse-bevels-1a.html
--- a/layout/tools/reftest/reftest.jsm
+++ b/layout/tools/reftest/reftest.jsm
@@ -840,16 +840,24 @@ function AddTestItem(aTest, aFilter)
     if (aTest.url2 !== null)
         aTest.identifier = [aTest.prettyPath, aTest.type, aTest.url2.spec];
     else
         aTest.identifier = aTest.prettyPath;
 
     gURLs.push(aTest);
 }
 
+function AddStyloTestPrefs(aSandbox, aTestPrefSettings, aRefPrefSettings)
+{
+    AddPrefSettings("test-", "layout.css.servo.enabled", "true", aSandbox,
+                    aTestPrefSettings, aRefPrefSettings);
+    AddPrefSettings("ref-", "layout.css.servo.enabled", "false", aSandbox,
+                    aTestPrefSettings, aRefPrefSettings);
+}
+
 // Note: If you materially change the reftest manifest parsing,
 // please keep the parser in print-manifest-dirs.py in sync.
 function ReadManifest(aURL, inherited_status, aFilter)
 {
     // Ensure each manifest is only read once. This assumes that manifests that are
     // included with an unusual inherited_status or filters will be read via their
     // include before they are read directly in the case of a duplicate
     if (gManifestsLoaded.hasOwnProperty(aURL.spec)) {
@@ -874,16 +882,20 @@ function ReadManifest(aURL, inherited_st
     inputStream.close();
     var lines = streamBuf.split(/\n|\r|\r\n/);
 
     // Build the sandbox for fails-if(), etc., condition evaluation.
     var sandbox = BuildConditionSandbox(aURL);
     var lineNo = 0;
     var urlprefix = "";
     var defaultTestPrefSettings = [], defaultRefPrefSettings = [];
+    if (gCompareStyloToGecko) {
+        AddStyloTestPrefs(sandbox, defaultTestPrefSettings,
+                          defaultRefPrefSettings);
+    }
     for (var str of lines) {
         ++lineNo;
         if (str.charAt(0) == "#")
             continue; // entire line was a comment
         var i = str.search(/\s+#/);
         if (i >= 0)
             str = str.substring(0, i);
         // strip leading and trailing whitespace
@@ -908,16 +920,20 @@ function ReadManifest(aURL, inherited_st
             while ((item = items.shift())) {
                 if (!(m = item.match(gPrefItemRE))) {
                     throw "Unexpected item in default-preferences list in manifest file " + aURL.spec + " line " + lineNo;
                 }
                 if (!AddPrefSettings(m[1], m[2], m[3], sandbox, defaultTestPrefSettings, defaultRefPrefSettings)) {
                     throw "Error in pref value in manifest file " + aURL.spec + " line " + lineNo;
                 }
             }
+            if (gCompareStyloToGecko) {
+                AddStyloTestPrefs(sandbox, defaultTestPrefSettings,
+                                  defaultRefPrefSettings);
+            }
             continue;
         }
 
         var expected_status = EXPECTED_PASS;
         var allow_silent_fail = false;
         var minAsserts = 0;
         var maxAsserts = 0;
         var needs_focus = false;
@@ -1316,26 +1332,16 @@ function StartCurrentURI(aState)
     gState = aState;
     gCurrentURL = gURLs[0]["url" + aState].spec;
 
     RestoreChangedPreferences();
 
     var prefs = Components.classes["@mozilla.org/preferences-service;1"].
         getService(Components.interfaces.nsIPrefBranch);
 
-    if (gCompareStyloToGecko) {
-        if (gState == 2){
-            logger.info("Disabling Servo-backed style system");
-            prefs.setBoolPref('layout.css.servo.enabled', false);
-        } else {
-            logger.info("Enabling Servo-backed style system");
-            prefs.setBoolPref('layout.css.servo.enabled', true);
-        }
-    }
-
     var prefSettings = gURLs[0]["prefSettings" + aState];
     if (prefSettings.length > 0) {
         var badPref = undefined;
         try {
             prefSettings.forEach(function(ps) {
                 var oldVal;
                 if (ps.type == PREF_BOOLEAN) {
                     try {