gecko/layout/tools/reftest/b2g_start_script.js
Bobby Holley 7a055e0974 Bug 857356 - Make reftests/crashtest run without XBL scopes. r=bz
I talked about this with bz. The issue is that we have a lot of XUL reftests
that end up getting run as remote XUL given that the reftest harness loads
them with file:// URIs. But realistically most of them probably want to test
the fully-featured XBL environment that we provide to frontend and extensions.

So the compromise here is to do XBL scopes for content, and no XBL scopes
for reftests/crashtests.
2013-05-09 09:16:02 -07:00

48 lines
2.1 KiB
JavaScript

args = __marionetteParams;
function setDefaultPrefs() {
// This code sets the preferences for extension-based reftest; for
// command-line based reftest they are set in function handler_handle in
// reftest-cmdline.js. These two locations should stay in sync.
//
// FIXME: These should be in only one place.
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefService);
var branch = prefs.getDefaultBranch("");
branch.setBoolPref("dom.use_xbl_scopes_for_remote_xul", false);
branch.setBoolPref("gfx.color_management.force_srgb", true);
branch.setBoolPref("browser.dom.window.dump.enabled", true);
branch.setIntPref("ui.caretBlinkTime", -1);
branch.setBoolPref("dom.send_after_paint_to_content", true);
// no slow script dialogs
branch.setIntPref("dom.max_script_run_time", 0);
branch.setIntPref("dom.max_chrome_script_run_time", 0);
branch.setIntPref("hangmonitor.timeout", 0);
// Ensure autoplay is enabled for all platforms.
branch.setBoolPref("media.autoplay.enabled", true);
// Disable updates
branch.setBoolPref("app.update.enabled", false);
}
function setPermissions(webserver, port) {
var perms = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI("http://" + webserver + ":" + port, null, null);
perms.add(uri, "allowXULXBL", Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
}
// Load into any existing windows
let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
let win = wm.getMostRecentWindow('');
// Set preferences and permissions
setDefaultPrefs();
setPermissions(args[0], args[1]);
// Start the reftests
Components.utils.import("chrome://reftest/content/reftest.jsm");
OnRefTestLoad(win);