Backout 5218cec180c8.
authorCameron McCormack <cam@mcc.id.au>
Wed, 28 Nov 2012 10:39:47 +1100
changeset 114308 ae5e741238ccf7679ad78411dbe183b53af51523
parent 114307 af301a7b9ecfe3848ce42b174e1de709e5fcdd7a
child 114309 c8766443985c6c82b3f35253bad3fb0a8d55dbfd
push id23913
push useremorley@mozilla.com
push dateWed, 28 Nov 2012 17:11:31 +0000
treeherdermozilla-central@17c267a881cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone20.0a1
backs out5218cec180c8c2d449c79f2b59dd23628aa77509
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
Backout 5218cec180c8.
layout/reftests/reftest-sanity/default-preferences-include.list
layout/reftests/reftest-sanity/default-preferences-tests.list
layout/reftests/reftest-sanity/reftest.list
layout/tools/reftest/README.txt
layout/tools/reftest/reftest.js
deleted file mode 100644
--- a/layout/reftests/reftest-sanity/default-preferences-include.list
+++ /dev/null
@@ -1,6 +0,0 @@
-# test default-preferences on include commands
-
-# In default-preferences-tests.list, the default-preferences line in effect
-# before the include statement sets different font sizes for the test and
-# reference files. Those default preferences should not inherit into this file.
-== font-default.html font-default.html
deleted file mode 100644
--- a/layout/reftests/reftest-sanity/default-preferences-tests.list
+++ /dev/null
@@ -1,28 +0,0 @@
-# test default-preferences
-
-# test default-preferences with a pref()
-default-preferences pref(font.size.variable.x-western,24)
-!= font-default.html font-size-16.html
-== font-default.html font-size-24.html
-
-# test that a default preference can be overridden
-pref(font.size.variable.x-western,16) == font-default.html font-size-16.html
-pref(font.size.variable.x-western,16) != font-default.html font-size-24.html
-
-# test that default preferences are kept when other test-specific preferences are set
-pref(font.size.variable.zh-HK,36) != font-default.html font-size-16.html
-pref(font.size.variable.zh-HK,36) == font-default.html font-size-24.html
-
-# test default-preferences with test-pref() and ref-pref()
-default-preferences test-pref(font.size.variable.x-western,16) ref-pref(font.size.variable.x-western,24)
-!= font-default.html font-default.html
-== font-default.html font-size-16.html
-== font-size-24.html font-default.html
-
-# test that default-preferences does not apply to include commands
-include default-preferences-include.list
-
-# test resetting default-preferences
-default-preferences
-== font-default.html font-default.html
-
--- a/layout/reftests/reftest-sanity/reftest.list
+++ b/layout/reftests/reftest-sanity/reftest.list
@@ -60,19 +60,16 @@ asserts-if(false,6-8) load about:blank
 == div.html div-ref.html
 
 # test script keyword
 include scripttests.list
 
 # test url-prefix
 include urlprefixtests.list
 
-# test default-preferences
-include default-preferences-tests.list
-
 # test that all corners are visible
 != corners-1.html corners-1-ref.html
 != corners-2.html corners-2-ref.html
 != corners-3.html corners-3-ref.html
 != corners-4.html corners-4-ref.html
 
 # Test that the harness gives the correct page dimensions.
 != page-width-3.9in.html page-width-4in.html
--- a/layout/tools/reftest/README.txt
+++ b/layout/tools/reftest/README.txt
@@ -285,38 +285,16 @@ 3. Specification of a url prefix
    <string> will not be prepended to any <url> or <url_ref> matching the pattern
    /^\w+:/. This will prevent the prefix from being applied to any absolute url
    containing a protocol such as data:, about:, or http:.
 
    While the typical use of url-prefix is expected to be as the first line of
    a manifest, it is legal to use it anywhere in a manifest. Subsequent uses
    of url-prefix overwrite any existing values.
 
-4. Specification of default preferences
-
-   default-preferences <preference>*
-
-   where <preference> is defined above.
-
-   The <preference> settings will be used for all following test items in the
-   manifest.
-
-   If a test item includes its own preference settings, then they will override
-   any settings for preferences of the same names that are set using
-   default-preferences, just as later items within a line override earlier ones.
-
-   A default-preferences line with no <preference> settings following it will
-   reset the set of default preferences to be empty.
-
-   As with url-prefix, default-preferences will often be used at the start of a
-   manifest file so that it applies to all test items, but it is legal for
-   default-preferences to appear anywhere in the manifest. A subsequent
-   default-preferences will reset any previous default preference values and
-   overwrite them with the specified <preference> values.
-
 This test manifest format could be used by other harnesses, such as ones
 that do not depend on XUL, or even ones testing other layout engines.
 
 Running Tests
 =============
 
 (If you're not using a DEBUG build, first set browser.dom.window.dump.enabled
 to true (in about:config, in the profile you'll be using to run the tests).
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -125,17 +125,16 @@ const EXPECTED_FUZZY = 4;
 // types of preference value we might want to set for a specific test
 const PREF_BOOLEAN = 0;
 const PREF_STRING  = 1;
 const PREF_INTEGER = 2;
 
 var gPrefsToRestore = [];
 
 const gProtocolRE = /^\w+:/;
-const gPrefItemRE = /^(|test-|ref-)pref\((.+?),(.*)\)$/;
 
 var HTTP_SERVER_PORT = 4444;
 const HTTP_SERVER_PORTS_TO_TRY = 50;
 
 // whether to run slow tests or not
 var gRunSlowTests = true;
 
 // whether we should skip caching canvases
@@ -650,42 +649,16 @@ function BuildConditionSandbox(aURL) {
     if (!gDumpedConditionSandbox) {
         dump("REFTEST INFO | Dumping JSON representation of sandbox \n");
         dump("REFTEST INFO | " + JSON.stringify(sandbox) + " \n");
         gDumpedConditionSandbox = true;
     }
     return sandbox;
 }
 
-function AddPrefSettings(aWhere, aPrefName, aPrefValExpression, aSandbox, aTestPrefSettings, aRefPrefSettings)
-{
-    var prefVal = Components.utils.evalInSandbox("(" + aPrefValExpression + ")", aSandbox);
-    var prefType;
-    var valType = typeof(prefVal);
-    if (valType == "boolean") {
-        prefType = PREF_BOOLEAN;
-    } else if (valType == "string") {
-        prefType = PREF_STRING;
-    } else if (valType == "number" && (parseInt(prefVal) == prefVal)) {
-        prefType = PREF_INTEGER;
-    } else {
-        return false;
-    }
-    var setting = { name: aPrefName,
-                    type: prefType,
-                    value: prefVal };
-    if (aWhere != "ref-") {
-        aTestPrefSettings.push(setting);
-    }
-    if (aWhere != "test-") {
-        aRefPrefSettings.push(setting);
-    }
-    return true;
-}
-
 function ReadTopManifest(aFileURL)
 {
     gURLs = new Array();
     var url = gIOService.newURI(aFileURL, null, null);
     if (!url)
         throw "Expected a file or http URL for the manifest.";
     ReadManifest(url, EXPECTED_PASS);
 }
@@ -715,17 +688,16 @@ function ReadManifest(aURL, inherited_st
     var streamBuf = getStreamContent(inputStream);
     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 = [];
     for each (var str in 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
@@ -736,41 +708,23 @@ function ReadManifest(aURL, inherited_st
 
         if (items[0] == "url-prefix") {
             if (items.length != 2)
                 throw "url-prefix requires one url in manifest file " + aURL.spec + " line " + lineNo;
             urlprefix = items[1];
             continue;
         }
 
-        if (items[0] == "default-preferences") {
-            var m;
-            var item;
-            defaultTestPrefSettings = [];
-            defaultRefPrefSettings = [];
-            items.shift();
-            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;
-                }
-            }
-            continue;
-        }
-
         var expected_status = EXPECTED_PASS;
         var allow_silent_fail = false;
         var minAsserts = 0;
         var maxAsserts = 0;
         var needs_focus = false;
         var slow = false;
-        var testPrefSettings = defaultTestPrefSettings.concat();
-        var refPrefSettings = defaultRefPrefSettings.concat();
+        var testPrefSettings = [], refPrefSettings = [];
         var fuzzy_max_delta = 2;
         var fuzzy_max_pixels = 1;
 
         while (items[0].match(/^(fails|needs-focus|random|skip|asserts|slow|require-or|silentfail|pref|test-pref|ref-pref|fuzzy)/)) {
             var item = items.shift();
             var stat;
             var cond;
             var m = item.match(/^(fails|random|skip|silentfail)-if(\(.*\))$/);
@@ -826,21 +780,41 @@ function ReadManifest(aURL, inherited_st
                 }
             } else if ((m = item.match(/^slow-if\((.*?)\)$/))) {
                 cond = false;
                 if (Components.utils.evalInSandbox("(" + m[1] + ")", sandbox))
                     slow = true;
             } else if (item == "silentfail") {
                 cond = false;
                 allow_silent_fail = true;
-            } else if ((m = item.match(gPrefItemRE))) {
+            } else if ((m = item.match(/^(|test-|ref-)pref\((.+?),(.*)\)$/))) {
                 cond = false;
-                if (!AddPrefSettings(m[1], m[2], m[3], sandbox, testPrefSettings, refPrefSettings)) {
+                var where = m[1];
+                var prefName = m[2];
+                var prefVal = Components.utils.evalInSandbox("(" + m[3] + ")", sandbox);
+                var prefType;
+                var valType = typeof(prefVal);
+                if (valType == "boolean") {
+                    prefType = PREF_BOOLEAN;
+                } else if (valType == "string") {
+                    prefType = PREF_STRING;
+                } else if (valType == "number" && (parseInt(prefVal) == prefVal)) {
+                    prefType = PREF_INTEGER;
+                } else {
                     throw "Error in pref value in manifest file " + aURL.spec + " line " + lineNo;
                 }
+                var setting = { name: prefName,
+                                type: prefType,
+                                value: prefVal };
+                if (where != "ref-") {
+                    testPrefSettings.push(setting);
+                }
+                if (where != "test-") {
+                    refPrefSettings.push(setting);
+                }
             } else if ((m = item.match(/^fuzzy\((\d+),(\d+)\)$/))) {
               cond = false;
               expected_status = EXPECTED_FUZZY;
               fuzzy_max_delta = Number(m[1]);
               fuzzy_max_pixels = Number(m[2]);
             } else if ((m = item.match(/^fuzzy-if\((.*?),(\d+),(\d+)\)$/))) {
               cond = false;
               if (Components.utils.evalInSandbox("(" + m[1] + ")", sandbox)) {