Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | function setDefaultPrefs() { |
michael@0 | 6 | // This code sets the preferences for extension-based reftest. |
michael@0 | 7 | var prefs = Cc["@mozilla.org/preferences-service;1"]. |
michael@0 | 8 | getService(Ci.nsIPrefService); |
michael@0 | 9 | var branch = prefs.getDefaultBranch(""); |
michael@0 | 10 | |
michael@0 | 11 | #include reftest-preferences.js |
michael@0 | 12 | } |
michael@0 | 13 | |
michael@0 | 14 | function setPermissions() { |
michael@0 | 15 | if (__marionetteParams.length < 2) { |
michael@0 | 16 | return; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | let serverAddr = __marionetteParams[0]; |
michael@0 | 20 | let serverPort = __marionetteParams[1]; |
michael@0 | 21 | let perms = Cc["@mozilla.org/permissionmanager;1"] |
michael@0 | 22 | .getService(Ci.nsIPermissionManager); |
michael@0 | 23 | let ioService = Cc["@mozilla.org/network/io-service;1"] |
michael@0 | 24 | .getService(Ci.nsIIOService); |
michael@0 | 25 | let uri = ioService.newURI("http://" + serverAddr + ":" + serverPort, null, null); |
michael@0 | 26 | perms.add(uri, "allowXULXBL", Ci.nsIPermissionManager.ALLOW_ACTION); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | // Load into any existing windows |
michael@0 | 30 | let wm = Cc["@mozilla.org/appshell/window-mediator;1"] |
michael@0 | 31 | .getService(Ci.nsIWindowMediator); |
michael@0 | 32 | let win = wm.getMostRecentWindow(''); |
michael@0 | 33 | |
michael@0 | 34 | // Set preferences and permissions |
michael@0 | 35 | setDefaultPrefs(); |
michael@0 | 36 | setPermissions(); |
michael@0 | 37 | |
michael@0 | 38 | // Loading this into the global namespace causes intermittent failures. |
michael@0 | 39 | // See bug 882888 for more details. |
michael@0 | 40 | let reftest = {}; |
michael@0 | 41 | Cu.import("chrome://reftest/content/reftest.jsm", reftest); |
michael@0 | 42 | |
michael@0 | 43 | // Start the reftests |
michael@0 | 44 | reftest.OnRefTestLoad(win); |