Clean up setting of preferences for reftest. (Bug 608030) r=roc a=blocking2.0:betaN+

This commit is contained in:
L. David Baron 2011-01-24 16:23:07 -08:00
Родитель 51aff3c842
Коммит 177b2600d0
3 изменённых файлов: 20 добавлений и 16 удалений

Просмотреть файл

@ -92,11 +92,24 @@ RefTestCmdLineHandler.prototype =
ios.manageOfflineStatus = false; ios.manageOfflineStatus = false;
ios.offline = false; ios.offline = false;
/* Force sRGB as an output profile for color management before we load a /**
window. */ * 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.
*/
var prefs = Components.classes["@mozilla.org/preferences-service;1"]. var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefService);
prefs.setBoolPref("gfx.color_management.force_srgb", true); 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);
var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(nsIWindowWatcher); .getService(nsIWindowWatcher);

Просмотреть файл

@ -359,11 +359,6 @@ function StartTests()
function OnRefTestUnload() 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); gBrowser.removeEventListener("load", OnDocumentLoad, true);
MozillaFileLogger.close(); MozillaFileLogger.close();
} }

Просмотреть файл

@ -71,12 +71,11 @@ class RefTest(object):
self.automation.setupPermissionsDatabase(profileDir, self.automation.setupPermissionsDatabase(profileDir,
{'allowXULXBL': [('localhost', True), ('<file>', True)]}) {'allowXULXBL': [('localhost', True), ('<file>', True)]})
# Set preferences. # 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 .
prefsFile = open(os.path.join(profileDir, "user.js"), "w") 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("reftest.timeout", %d);\n' % (options.timeout * 1000))
prefsFile.write('user_pref("ui.caretBlinkTime", -1);\n')
if options.totalChunks != None: if options.totalChunks != None:
prefsFile.write('user_pref("reftest.totalChunks", %d);\n' % options.totalChunks) prefsFile.write('user_pref("reftest.totalChunks", %d);\n' % options.totalChunks)
@ -92,9 +91,6 @@ class RefTest(object):
sys.exit(1) sys.exit(1)
part = 'user_pref("%s", %s);\n' % (thispref[0], thispref[1]) part = 'user_pref("%s", %s);\n' % (thispref[0], thispref[1])
prefsFile.write(part) 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() prefsFile.close()
# install the reftest extension bits into the profile # install the reftest extension bits into the profile