Bug 1382427 - Support running reftest in a mode that runs the test with Retained Display lists on, and references with it off. r=mattwoodrow
authorJonathan Watt <jwatt@jwatt.org>
Tue, 31 Oct 2017 09:44:17 +0000
changeset 391984 4162a11c0a7e692cf8bfdf27b66363201823c354
parent 391983 907fb4683dfef81fbb746035939ac8154b66dfe5
child 391985 815b8640da1e3029dd680e4187b68852d36e2a4e
push id32909
push usercbrindusan@mozilla.com
push dateWed, 15 Nov 2017 22:25:14 +0000
treeherdermozilla-central@f41930a869a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1382427
milestone59.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 1382427 - Support running reftest in a mode that runs the test with Retained Display lists on, and references with it off. r=mattwoodrow This change adds a pref reftest.compareRetainedDisplayLists to enable this mode. MozReview-Commit-ID: JxSkJrQifQx
layout/tools/reftest/globals.jsm
layout/tools/reftest/manifest.jsm
layout/tools/reftest/reftest.jsm
--- a/layout/tools/reftest/globals.jsm
+++ b/layout/tools/reftest/globals.jsm
@@ -64,16 +64,17 @@ for (let [key, val] of Object.entries({
     runUntilFailure: false,
     cleanupPendingCrashes: false,
     totalChunks: 0,
     thisChunk: 0,
     containingWindow: null,
     urlFilterRegex: {},
     contentGfxInfo: null,
     focusFilterMode: "all",
+    compareRetainedDisplayLists: false,
     compareStyloToGecko: false,
 
     browser: undefined,
     // Are we testing web content loaded in a separate process?
     browserIsRemote: undefined,        // bool
     // Are we using <iframe mozbrowser>?
     browserIsIframe: undefined,        // bool
     browserMessageManager: undefined,  // bool
--- a/layout/tools/reftest/manifest.jsm
+++ b/layout/tools/reftest/manifest.jsm
@@ -63,16 +63,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 (g.compareRetainedDisplayLists) {
+        AddRetainedDisplayListTestPrefs(sandbox, defaultTestPrefSettings,
+                                        defaultRefPrefSettings);
+    }
     if (g.compareStyloToGecko) {
         AddStyloTestPrefs(sandbox, defaultTestPrefSettings,
                           defaultRefPrefSettings);
     }
     for (var str of lines) {
         ++lineNo;
         if (str.charAt(0) == "#")
             continue; // entire line was a comment
@@ -101,16 +105,20 @@ function ReadManifest(aURL, inherited_st
             while ((item = items.shift())) {
                 if (!(m = item.match(RE_PREF_ITEM))) {
                     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 (g.compareRetainedDisplayLists) {
+                AddRetainedDisplayListTestPrefs(sandbox, defaultTestPrefSettings,
+                                                defaultRefPrefSettings);
+            }
             if (g.compareStyloToGecko) {
                 AddStyloTestPrefs(sandbox, defaultTestPrefSettings,
                                   defaultRefPrefSettings);
             }
             continue;
         }
 
         var expected_status = EXPECTED_PASS;
@@ -346,17 +354,17 @@ function ReadManifest(aURL, inherited_st
             var prettyPath = runHttp
                            ? g.ioService.newURI(items[1], null, listURL).spec
                            : testURI.spec;
             secMan.checkLoadURIWithPrincipal(principal, testURI,
                                              CI.nsIScriptSecurityManager.DISALLOW_SCRIPT);
             secMan.checkLoadURIWithPrincipal(principal, refURI,
                                              CI.nsIScriptSecurityManager.DISALLOW_SCRIPT);
             var type = items[0];
-            if (g.compareStyloToGecko) {
+            if (g.compareStyloToGecko || g.compareRetainedDisplayLists) {
                 type = TYPE_REFTEST_EQUAL;
                 refURI = testURI;
 
                 // We expect twice as many assertion failures when running in
                 // styloVsGecko mode because we run each test twice: once in
                 // Stylo mode and once in Gecko mode.
                 minAsserts *= 2;
                 maxAsserts *= 2;
@@ -505,16 +513,20 @@ function BuildConditionSandbox(aURL) {
 #endif
 
 #if MOZ_WEBRTC
     sandbox.webrtc = true;
 #else
     sandbox.webrtc = false;
 #endif
 
+let retainedDisplayListsEnabled = prefs.getBoolPref("layout.display-list.retain", false);
+sandbox.retainedDisplayLists = retainedDisplayListsEnabled && !g.compareRetainedDisplayLists;
+sandbox.compareRetainedDisplayLists = g.compareRetainedDisplayLists;
+
 #ifdef MOZ_STYLO
     let styloEnabled = false;
     // Perhaps a bit redundant in places, but this is easier to compare with the
     // the real check in `nsLayoutUtils.cpp` to ensure they test the same way.
     if (env.get("STYLO_FORCE_ENABLED")) {
         styloEnabled = true;
     } else if (env.get("STYLO_FORCE_DISABLED")) {
         styloEnabled = false;
@@ -592,16 +604,24 @@ function BuildConditionSandbox(aURL) {
         g.logger.info("Dumping JSON representation of sandbox");
         g.logger.info(JSON.stringify(CU.waiveXrays(sandbox)));
         g.dumpedConditionSandbox = true;
     }
 
     return sandbox;
 }
 
+function AddRetainedDisplayListTestPrefs(aSandbox, aTestPrefSettings,
+                                         aRefPrefSettings) {
+    AddPrefSettings("test-", "layout.display-list.retain", "true", aSandbox,
+                    aTestPrefSettings, aRefPrefSettings);
+    AddPrefSettings("ref-", "layout.display-list.retain", "false", aSandbox,
+                    aTestPrefSettings, aRefPrefSettings);
+}
+
 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);
 }
 
 function AddPrefSettings(aWhere, aPrefName, aPrefValExpression, aSandbox, aTestPrefSettings, aRefPrefSettings) {
@@ -616,17 +636,18 @@ function AddPrefSettings(aWhere, aPrefNa
         prefType = PREF_INTEGER;
     } else {
         return false;
     }
     var setting = { name: aPrefName,
                     type: prefType,
                     value: prefVal };
 
-    if (g.compareStyloToGecko && aPrefName != "layout.css.servo.enabled") {
+    if ((g.compareStyloToGecko && aPrefName != "layout.css.servo.enabled") ||
+        (g.compareRetainedDisplayLists && aPrefName != "layout.display-list.retain")) {
         // ref-pref() is ignored, test-pref() and pref() are added to both
         if (aWhere != "ref-") {
             aTestPrefSettings.push(setting);
             aRefPrefSettings.push(setting);
         }
     } else {
         if (aWhere != "ref-") {
             aTestPrefSettings.push(setting);
--- a/layout/tools/reftest/reftest.jsm
+++ b/layout/tools/reftest/reftest.jsm
@@ -268,16 +268,19 @@ function InitAndStartRefTests()
     } catch(e) {}
 
     try {
         g.startAfter = prefs.getCharPref("reftest.startAfter");
     } catch(e) {
         g.startAfter = undefined;
     }
 
+    try {
+        g.compareRetainedDisplayLists = prefs.getBoolPref("reftest.compareRetainedDisplayLists");
+    } catch (e) {}
 #ifdef MOZ_STYLO
     try {
         g.compareStyloToGecko = prefs.getBoolPref("reftest.compareStyloToGecko");
     } catch(e) {}
 #endif
 
 #ifdef MOZ_ENABLE_SKIA_PDF
     try {