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 /**
5 * Test that if we black box a source and then refresh, it is still black boxed.
6 */
8 const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
10 let gTab, gDebuggee, gPanel, gDebugger;
12 function test() {
13 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
14 gTab = aTab;
15 gDebuggee = aDebuggee;
16 gPanel = aPanel;
17 gDebugger = gPanel.panelWin;
19 waitForSourceShown(gPanel, ".coffee")
20 .then(testBlackBoxSource)
21 .then(testBlackBoxReload)
22 .then(() => closeDebuggerAndFinish(gPanel))
23 .then(null, aError => {
24 ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
25 });
26 });
27 }
29 function testBlackBoxSource() {
30 const bbButton = getBlackBoxButton(gPanel);
31 ok(!bbButton.checked, "Should not be black boxed by default");
33 return toggleBlackBoxing(gPanel).then(aSource => {
34 ok(aSource.isBlackBoxed, "The source should be black boxed now.");
35 ok(bbButton.checked, "The checkbox should no longer be checked.");
36 });
37 }
39 function testBlackBoxReload() {
40 return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => {
41 const bbButton = getBlackBoxButton(gPanel);
42 ok(bbButton.checked, "Should still be black boxed.");
43 });
44 }
46 registerCleanupFunction(function() {
47 gTab = null;
48 gDebuggee = null;
49 gPanel = null;
50 gDebugger = null;
51 });