|
1 /* |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
4 */ |
|
5 |
|
6 // Check that the navigation marker shows on page reload - bug 793996. |
|
7 |
|
8 function test() |
|
9 { |
|
10 const PREF = "devtools.webconsole.persistlog"; |
|
11 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html"; |
|
12 let hud = null; |
|
13 let Messages = require("devtools/webconsole/console-output").Messages; |
|
14 |
|
15 Services.prefs.setBoolPref(PREF, true); |
|
16 registerCleanupFunction(() => Services.prefs.clearUserPref(PREF)); |
|
17 |
|
18 addTab(TEST_URI); |
|
19 |
|
20 browser.addEventListener("load", function onLoad() { |
|
21 browser.removeEventListener("load", onLoad, true); |
|
22 openConsole(null, consoleOpened); |
|
23 }, true); |
|
24 |
|
25 function consoleOpened(aHud) |
|
26 { |
|
27 hud = aHud; |
|
28 ok(hud, "Web Console opened"); |
|
29 |
|
30 hud.jsterm.clearOutput(); |
|
31 content.console.log("foobarz1"); |
|
32 waitForMessages({ |
|
33 webconsole: hud, |
|
34 messages: [{ |
|
35 text: "foobarz1", |
|
36 category: CATEGORY_WEBDEV, |
|
37 severity: SEVERITY_LOG, |
|
38 }], |
|
39 }).then(onConsoleMessage); |
|
40 } |
|
41 |
|
42 function onConsoleMessage() |
|
43 { |
|
44 browser.addEventListener("load", onReload, true); |
|
45 content.location.reload(); |
|
46 } |
|
47 |
|
48 function onReload() |
|
49 { |
|
50 browser.removeEventListener("load", onReload, true); |
|
51 |
|
52 content.console.log("foobarz2"); |
|
53 |
|
54 waitForMessages({ |
|
55 webconsole: hud, |
|
56 messages: [{ |
|
57 name: "page reload", |
|
58 text: "test-console.html", |
|
59 category: CATEGORY_NETWORK, |
|
60 severity: SEVERITY_LOG, |
|
61 }, |
|
62 { |
|
63 text: "foobarz2", |
|
64 category: CATEGORY_WEBDEV, |
|
65 severity: SEVERITY_LOG, |
|
66 }, |
|
67 { |
|
68 name: "navigation marker", |
|
69 text: "test-console.html", |
|
70 type: Messages.NavigationMarker, |
|
71 }], |
|
72 }).then(onConsoleMessageAfterReload); |
|
73 } |
|
74 |
|
75 function onConsoleMessageAfterReload() |
|
76 { |
|
77 isnot(hud.outputNode.textContent.indexOf("foobarz1"), -1, |
|
78 "foobarz1 is still in the output"); |
|
79 finishTest(); |
|
80 } |
|
81 } |