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