1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/commandline/test/head.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +const TEST_BASE_HTTP = "http://example.com/browser/browser/devtools/commandline/test/"; 1.9 +const TEST_BASE_HTTPS = "https://example.com/browser/browser/devtools/commandline/test/"; 1.10 + 1.11 +// Import the GCLI test helper 1.12 +let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/")); 1.13 +Services.scriptloader.loadSubScript(testDir + "/helpers.js", this); 1.14 +Services.scriptloader.loadSubScript(testDir + "/mockCommands.js", this); 1.15 + 1.16 +gDevTools.testing = true; 1.17 +SimpleTest.registerCleanupFunction(() => { 1.18 + gDevTools.testing = false; 1.19 +}); 1.20 + 1.21 +function whenDelayedStartupFinished(aWindow, aCallback) { 1.22 + Services.obs.addObserver(function observer(aSubject, aTopic) { 1.23 + if (aWindow == aSubject) { 1.24 + Services.obs.removeObserver(observer, aTopic); 1.25 + executeSoon(aCallback); 1.26 + } 1.27 + }, "browser-delayed-startup-finished", false); 1.28 +} 1.29 + 1.30 +/** 1.31 + * Force GC on shutdown, because it seems that GCLI can outrun the garbage 1.32 + * collector in some situations, which causes test failures in later tests 1.33 + * Bug 774619 is an example. 1.34 + */ 1.35 +registerCleanupFunction(function tearDown() { 1.36 + window.QueryInterface(Ci.nsIInterfaceRequestor) 1.37 + .getInterface(Ci.nsIDOMWindowUtils) 1.38 + .garbageCollect(); 1.39 +});