layout/tools/reftest/b2g_start_script.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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);

mercurial