Backout changeset ffebdc3ddb62 (bug 608030) due to reftest orange related to color-management pref. a=orange
authorL. David Baron <dbaron@dbaron.org>
Sun, 23 Jan 2011 22:00:32 -0800
changeset 61168 80266029824bf03159356f29ab04d0fc54a664b0
parent 61167 f5cf80c6dae4bf1a9df6a56cb8db521054fed5ec
child 61169 0d947763fe67c2a728141f97f328ce3b8055e270
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersorange
bugs608030
milestone2.0b10pre
backs outffebdc3ddb6272691777d1c99f13b12c8947bfa5
Backout changeset ffebdc3ddb62 (bug 608030) due to reftest orange related to color-management pref. a=orange
layout/tools/reftest/reftest-cmdline.js
layout/tools/reftest/reftest.js
layout/tools/reftest/runreftest.py
--- a/layout/tools/reftest/reftest-cmdline.js
+++ b/layout/tools/reftest/reftest-cmdline.js
@@ -87,34 +87,21 @@ RefTestCmdLineHandler.prototype =
     }
 
     /* Ignore the platform's online/offline status while running reftests. */
     var ios = Components.classes["@mozilla.org/network/io-service;1"]
               .getService(Components.interfaces.nsIIOService2);
     ios.manageOfflineStatus = false;
     ios.offline = false;
 
-    /**
-     * Manipulate preferences by adding to the *default* branch.  Adding
-     * to the default branch means the changes we make won't get written
-     * back to user preferences.
-     *
-     * We want to do this here rather than in reftest.js because it's
-     * important to force sRGB as an output profile for color management
-     * before we load a window.
-     */
+    /* Force sRGB as an output profile for color management before we load a
+       window. */
     var prefs = Components.classes["@mozilla.org/preferences-service;1"].
-                getService(Components.interfaces.nsIPrefService);
-    var branch = prefs.getDefaultBranch("");
-    branch.setBoolPref("gfx.color_management.force_srgb", true);
-    branch.setBoolPref("browser.dom.window.dump.enabled", true);
-    branch.setIntPref("ui.caretBlinkTime", -1);
-    // no slow script dialogs
-    branch.setIntPref("dom.max_script_run_time", 0);
-    branch.setIntPref("dom.max_chrome_script_run_time", 0);
+                getService(Components.interfaces.nsIPrefBranch2);
+    prefs.setBoolPref("gfx.color_management.force_srgb", true);
 
     var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
                            .getService(nsIWindowWatcher);
     wwatch.openWindow(null, "chrome://reftest/content/reftest.xul", "_blank",
                       "chrome,dialog=no,all", args);
     cmdLine.preventDefault = true;
   },
 
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -354,16 +354,21 @@ function StartTests()
         ++gTestResults.Exception;
         gDumpLog("REFTEST TEST-UNEXPECTED-FAIL | | EXCEPTION: " + ex + "\n");
         DoneTests();
     }
 }
 
 function OnRefTestUnload()
 {
+    /* Clear the sRGB forcing pref to leave the profile as we found it. */
+    var prefs = Components.classes["@mozilla.org/preferences-service;1"].
+                getService(Components.interfaces.nsIPrefBranch2);
+    prefs.clearUserPref("gfx.color_management.force_srgb");
+
     gBrowser.removeEventListener("load", OnDocumentLoad, true);
     MozillaFileLogger.close();
 }
 
 // Read all available data from an input stream and return it
 // as a string.
 function getStreamContent(inputStream)
 {
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -66,36 +66,40 @@ class RefTest(object):
     return self.getFullPath(path)
 
   def createReftestProfile(self, options, profileDir):
     "Sets up a profile for reftest."
 
     self.automation.setupPermissionsDatabase(profileDir,
       {'allowXULXBL': [('localhost', True), ('<file>', True)]})
 
-    # Set preferences for communication between our command line arguments
-    # and the reftest harness.  Preferences that are required for reftest
-    # to work should instead be set in reftest-cmdline.js .
+    # Set preferences.
     prefsFile = open(os.path.join(profileDir, "user.js"), "w")
+    prefsFile.write("""user_pref("browser.dom.window.dump.enabled", true);
+    """)
     prefsFile.write('user_pref("reftest.timeout", %d);\n' % (options.timeout * 1000))
+    prefsFile.write('user_pref("ui.caretBlinkTime", -1);\n')
 
     if options.totalChunks != None:
       prefsFile.write('user_pref("reftest.totalChunks", %d);\n' % options.totalChunks)
     if options.thisChunk != None:
       prefsFile.write('user_pref("reftest.thisChunk", %d);\n' % options.thisChunk)
     if options.logFile != None:
       prefsFile.write('user_pref("reftest.logFile", "%s");\n' % options.logFile)
 
     for v in options.extraPrefs:
       thispref = v.split("=")
       if len(thispref) < 2:
         print "Error: syntax error in --setpref=" + v
         sys.exit(1)
       part = 'user_pref("%s", %s);\n' % (thispref[0], thispref[1])
       prefsFile.write(part)
+    # no slow script dialogs
+    prefsFile.write('user_pref("dom.max_script_run_time", 0);')
+    prefsFile.write('user_pref("dom.max_chrome_script_run_time", 0);')
     prefsFile.close()
 
     # install the reftest extension bits into the profile
     self.automation.installExtension(os.path.join(SCRIPT_DIRECTORY, "reftest"),
                                                   profileDir,
                                                   "reftest@mozilla.org")