1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +const TEST_FILE = "test-network.html"; 1.10 + 1.11 +function tabReload(aEvent) { 1.12 + browser.removeEventListener(aEvent.type, tabReload, true); 1.13 + 1.14 + waitForMessages({ 1.15 + webconsole: hud, 1.16 + messages: [{ 1.17 + text: "running network console logging tests", 1.18 + category: CATEGORY_WEBDEV, 1.19 + severity: SEVERITY_LOG, 1.20 + }, 1.21 + { 1.22 + text: "test-network.html", 1.23 + category: CATEGORY_NETWORK, 1.24 + severity: SEVERITY_LOG, 1.25 + }, 1.26 + { 1.27 + text: "test-image.png", 1.28 + category: CATEGORY_NETWORK, 1.29 + severity: SEVERITY_LOG, 1.30 + }, 1.31 + { 1.32 + text: "testscript.js", 1.33 + category: CATEGORY_NETWORK, 1.34 + severity: SEVERITY_LOG, 1.35 + }], 1.36 + }).then(finishTest); 1.37 +} 1.38 + 1.39 +function test() { 1.40 + let jar = getJar(getRootDirectory(gTestPath)); 1.41 + let dir = jar ? 1.42 + extractJarToTmp(jar) : 1.43 + getChromeDir(getResolvedURI(gTestPath)); 1.44 + dir.append(TEST_FILE); 1.45 + 1.46 + let uri = Services.io.newFileURI(dir); 1.47 + 1.48 + const PREF = "devtools.webconsole.persistlog"; 1.49 + Services.prefs.setBoolPref(PREF, true); 1.50 + registerCleanupFunction(() => Services.prefs.clearUserPref(PREF)); 1.51 + 1.52 + addTab("data:text/html;charset=utf8,<p>test file URI"); 1.53 + browser.addEventListener("load", function tabLoad() { 1.54 + browser.removeEventListener("load", tabLoad, true); 1.55 + openConsole(null, function(aHud) { 1.56 + hud = aHud; 1.57 + hud.jsterm.clearOutput(); 1.58 + browser.addEventListener("load", tabReload, true); 1.59 + content.location = uri.spec; 1.60 + }); 1.61 + }, true); 1.62 +}