browser/devtools/webconsole/test/browser_webconsole_bug_595223_file_uri.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:10e11480edd5
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/. */
5
6 const TEST_FILE = "test-network.html";
7
8 function tabReload(aEvent) {
9 browser.removeEventListener(aEvent.type, tabReload, true);
10
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 }
35
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);
42
43 let uri = Services.io.newFileURI(dir);
44
45 const PREF = "devtools.webconsole.persistlog";
46 Services.prefs.setBoolPref(PREF, true);
47 registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
48
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