browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.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 /* vim:set ts=2 sw=2 sts=2 et: */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 const TEST_FILE = "test-network.html";
     8 function tabReload(aEvent) {
     9   browser.removeEventListener(aEvent.type, tabReload, true);
    11   waitForMessages({
    12     webconsole: hud,
    13     messages: [{
    14       text: "running network console logging tests",
    15       category: CATEGORY_WEBDEV,
    16       severity: SEVERITY_LOG,
    17     },
    18     {
    19       text: "test-network.html",
    20       category: CATEGORY_NETWORK,
    21       severity: SEVERITY_LOG,
    22     },
    23     {
    24       text: "test-image.png",
    25       category: CATEGORY_NETWORK,
    26       severity: SEVERITY_LOG,
    27     },
    28     {
    29       text: "testscript.js",
    30       category: CATEGORY_NETWORK,
    31       severity: SEVERITY_LOG,
    32     }],
    33   }).then(finishTest);
    34 }
    36 function test() {
    37   let jar = getJar(getRootDirectory(gTestPath));
    38   let dir = jar ?
    39             extractJarToTmp(jar) :
    40             getChromeDir(getResolvedURI(gTestPath));
    41   dir.append(TEST_FILE);
    43   let uri = Services.io.newFileURI(dir);
    45   const PREF = "devtools.webconsole.persistlog";
    46   Services.prefs.setBoolPref(PREF, true);
    47   registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
    49   addTab("data:text/html;charset=utf8,<p>test file URI");
    50   browser.addEventListener("load", function tabLoad() {
    51     browser.removeEventListener("load", tabLoad, true);
    52     openConsole(null, function(aHud) {
    53       hud = aHud;
    54       hud.jsterm.clearOutput();
    55       browser.addEventListener("load", tabReload, true);
    56       content.location = uri.spec;
    57     });
    58   }, true);
    59 }

mercurial