michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function setDefaultPrefs() { michael@0: // This code sets the preferences for extension-based reftest. michael@0: var prefs = Cc["@mozilla.org/preferences-service;1"]. michael@0: getService(Ci.nsIPrefService); michael@0: var branch = prefs.getDefaultBranch(""); michael@0: michael@0: #include reftest-preferences.js michael@0: } michael@0: michael@0: function setPermissions() { michael@0: if (__marionetteParams.length < 2) { michael@0: return; michael@0: } michael@0: michael@0: let serverAddr = __marionetteParams[0]; michael@0: let serverPort = __marionetteParams[1]; michael@0: let perms = Cc["@mozilla.org/permissionmanager;1"] michael@0: .getService(Ci.nsIPermissionManager); michael@0: let ioService = Cc["@mozilla.org/network/io-service;1"] michael@0: .getService(Ci.nsIIOService); michael@0: let uri = ioService.newURI("http://" + serverAddr + ":" + serverPort, null, null); michael@0: perms.add(uri, "allowXULXBL", Ci.nsIPermissionManager.ALLOW_ACTION); michael@0: } michael@0: michael@0: // Load into any existing windows michael@0: let wm = Cc["@mozilla.org/appshell/window-mediator;1"] michael@0: .getService(Ci.nsIWindowMediator); michael@0: let win = wm.getMostRecentWindow(''); michael@0: michael@0: // Set preferences and permissions michael@0: setDefaultPrefs(); michael@0: setPermissions(); michael@0: michael@0: // Loading this into the global namespace causes intermittent failures. michael@0: // See bug 882888 for more details. michael@0: let reftest = {}; michael@0: Cu.import("chrome://reftest/content/reftest.jsm", reftest); michael@0: michael@0: // Start the reftests michael@0: reftest.OnRefTestLoad(win);