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.
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Test for the message timestamps option: check if the preference toggles the
5 // display of messages in the console output. See bug 722267.
7 function test()
8 {
9 const PREF_MESSAGE_TIMESTAMP = "devtools.webconsole.timestampMessages";
10 let hud;
12 registerCleanupFunction(() => {
13 Services.prefs.clearUserPref(PREF_MESSAGE_TIMESTAMP);
14 });
16 addTab("data:text/html;charset=utf-8,Web Console test for bug 722267 - " +
17 "preference for toggling timestamps in messages");
19 browser.addEventListener("load", function tabLoad() {
20 browser.removeEventListener("load", tabLoad, true);
21 openConsole(null, consoleOpened);
22 }, true);
24 function consoleOpened(aHud)
25 {
26 hud = aHud;
28 info("console opened");
29 let prefValue = Services.prefs.getBoolPref(PREF_MESSAGE_TIMESTAMP);
30 ok(!prefValue, "messages have no timestamp by default (pref check)");
31 ok(hud.outputNode.classList.contains("hideTimestamps"),
32 "messages have no timestamp (class name check)");
34 let toolbox = gDevTools.getToolbox(hud.target);
35 toolbox.selectTool("options").then(onOptionsPanelSelected);
36 }
38 function onOptionsPanelSelected(panel)
39 {
40 info("options panel opened");
42 gDevTools.once("pref-changed", onPrefChanged);
44 let checkbox = panel.panelDoc.getElementById("webconsole-timestamp-messages");
45 checkbox.click();
46 }
48 function onPrefChanged()
49 {
50 info("pref changed");
51 let prefValue = Services.prefs.getBoolPref(PREF_MESSAGE_TIMESTAMP);
52 ok(prefValue, "messages have timestamps (pref check)");
53 ok(!hud.outputNode.classList.contains("hideTimestamps"),
54 "messages have timestamps (class name check)");
55 finishTest();
56 }
57 }