browser/devtools/commandline/test/head.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 const TEST_BASE_HTTP = "http://example.com/browser/browser/devtools/commandline/test/";
     6 const TEST_BASE_HTTPS = "https://example.com/browser/browser/devtools/commandline/test/";
     8 // Import the GCLI test helper
     9 let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
    10 Services.scriptloader.loadSubScript(testDir + "/helpers.js", this);
    11 Services.scriptloader.loadSubScript(testDir + "/mockCommands.js", this);
    13 gDevTools.testing = true;
    14 SimpleTest.registerCleanupFunction(() => {
    15   gDevTools.testing = false;
    16 });
    18 function whenDelayedStartupFinished(aWindow, aCallback) {
    19   Services.obs.addObserver(function observer(aSubject, aTopic) {
    20     if (aWindow == aSubject) {
    21       Services.obs.removeObserver(observer, aTopic);
    22       executeSoon(aCallback);
    23     }
    24   }, "browser-delayed-startup-finished", false);
    25 }
    27 /**
    28  * Force GC on shutdown, because it seems that GCLI can outrun the garbage
    29  * collector in some situations, which causes test failures in later tests
    30  * Bug 774619 is an example.
    31  */
    32 registerCleanupFunction(function tearDown() {
    33   window.QueryInterface(Ci.nsIInterfaceRequestor)
    34       .getInterface(Ci.nsIDOMWindowUtils)
    35       .garbageCollect();
    36 });

mercurial