michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Check that the navigation marker shows on page reload - bug 793996. michael@0: michael@0: function test() michael@0: { michael@0: const PREF = "devtools.webconsole.persistlog"; michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html"; michael@0: let hud = null; michael@0: let Messages = require("devtools/webconsole/console-output").Messages; michael@0: michael@0: Services.prefs.setBoolPref(PREF, true); michael@0: registerCleanupFunction(() => Services.prefs.clearUserPref(PREF)); michael@0: michael@0: addTab(TEST_URI); michael@0: michael@0: browser.addEventListener("load", function onLoad() { michael@0: browser.removeEventListener("load", onLoad, true); michael@0: openConsole(null, consoleOpened); michael@0: }, true); michael@0: michael@0: function consoleOpened(aHud) michael@0: { michael@0: hud = aHud; michael@0: ok(hud, "Web Console opened"); michael@0: michael@0: hud.jsterm.clearOutput(); michael@0: content.console.log("foobarz1"); michael@0: waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: text: "foobarz1", michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: }], michael@0: }).then(onConsoleMessage); michael@0: } michael@0: michael@0: function onConsoleMessage() michael@0: { michael@0: browser.addEventListener("load", onReload, true); michael@0: content.location.reload(); michael@0: } michael@0: michael@0: function onReload() michael@0: { michael@0: browser.removeEventListener("load", onReload, true); michael@0: michael@0: content.console.log("foobarz2"); michael@0: michael@0: waitForMessages({ michael@0: webconsole: hud, michael@0: messages: [{ michael@0: name: "page reload", michael@0: text: "test-console.html", michael@0: category: CATEGORY_NETWORK, michael@0: severity: SEVERITY_LOG, michael@0: }, michael@0: { michael@0: text: "foobarz2", michael@0: category: CATEGORY_WEBDEV, michael@0: severity: SEVERITY_LOG, michael@0: }, michael@0: { michael@0: name: "navigation marker", michael@0: text: "test-console.html", michael@0: type: Messages.NavigationMarker, michael@0: }], michael@0: }).then(onConsoleMessageAfterReload); michael@0: } michael@0: michael@0: function onConsoleMessageAfterReload() michael@0: { michael@0: isnot(hud.outputNode.textContent.indexOf("foobarz1"), -1, michael@0: "foobarz1 is still in the output"); michael@0: finishTest(); michael@0: } michael@0: }