browser/devtools/webconsole/test/browser_console_navigation_marker.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 // Check that the navigation marker shows on page reload - bug 793996.
     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;
    15   Services.prefs.setBoolPref(PREF, true);
    16   registerCleanupFunction(() => Services.prefs.clearUserPref(PREF));
    18   addTab(TEST_URI);
    20   browser.addEventListener("load", function onLoad() {
    21     browser.removeEventListener("load", onLoad, true);
    22     openConsole(null, consoleOpened);
    23   }, true);
    25   function consoleOpened(aHud)
    26   {
    27     hud = aHud;
    28     ok(hud, "Web Console opened");
    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   }
    42   function onConsoleMessage()
    43   {
    44     browser.addEventListener("load", onReload, true);
    45     content.location.reload();
    46   }
    48   function onReload()
    49   {
    50     browser.removeEventListener("load", onReload, true);
    52     content.console.log("foobarz2");
    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   }
    75   function onConsoleMessageAfterReload()
    76   {
    77     isnot(hud.outputNode.textContent.indexOf("foobarz1"), -1,
    78           "foobarz1 is still in the output");
    79     finishTest();
    80   }
    81 }

mercurial