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.

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

mercurial