Bug 1382427 - Support running reftests with retained display lists on for the test files only. r=mattwoodrow
☠☠ backed out by 907fb4683dfe ☠ ☠
authorJonathan Watt <jwatt@jwatt.org>
Mon, 30 Oct 2017 18:09:41 +0000
changeset 391981 c2bf7ca0839c7be4964557d10eab2b198004c803
parent 391980 62bed90e6a11a437a92899173d9698079bfa164e
child 391982 1a03e40f850a2477dcaccc89245a3e73c661ea9c
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 reftests with retained display lists on for the test files only. r=mattwoodrow MozReview-Commit-ID: 4n2kvXU2RYo
layout/tools/reftest/globals.jsm
layout/tools/reftest/manifest.jsm
layout/tools/reftest/reftest.jsm
modules/libpref/init/all.js
--- 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 {
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3125,16 +3125,17 @@ pref("layout.frame_rate", -1);
 // pref to dump the display list to the log. Useful for debugging drawing.
 pref("layout.display-list.dump", false);
 pref("layout.display-list.dump-content", false);
 pref("layout.display-list.dump-parent", false);
 
 // Toggle retaining display lists between paints
 #if !defined(ANDROID) && defined(NIGHTLY_BUILD)
 pref("layout.display-list.retain", true);
+pref("reftest.compareRetainedDisplayLists", true);
 #else
 pref("layout.display-list.retain", false);
 #endif
 
 // Set the maximum amount of modified frames allowed before doing a full
 // display list rebuild.
 pref("layout.display-list.rebuild-frame-limit", 500);