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 | /* vim: set ts=2 et sw=2 tw=80: */ |
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 | function test() |
michael@0 | 6 | { |
michael@0 | 7 | waitForExplicitFinish(); |
michael@0 | 8 | |
michael@0 | 9 | gBrowser.selectedTab = gBrowser.addTab(); |
michael@0 | 10 | gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
michael@0 | 11 | gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
michael@0 | 12 | openScratchpad(runTests); |
michael@0 | 13 | }, true); |
michael@0 | 14 | |
michael@0 | 15 | content.location = "data:text/html;charset=utf8,test Scratchpad pretty print."; |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | let gTabsize; |
michael@0 | 19 | |
michael@0 | 20 | function runTests(sw) |
michael@0 | 21 | { |
michael@0 | 22 | gTabsize = Services.prefs.getIntPref("devtools.editor.tabsize"); |
michael@0 | 23 | Services.prefs.setIntPref("devtools.editor.tabsize", 6); |
michael@0 | 24 | const space = " ".repeat(6); |
michael@0 | 25 | |
michael@0 | 26 | const sp = sw.Scratchpad; |
michael@0 | 27 | sp.setText("function main() { console.log(5); }"); |
michael@0 | 28 | sp.prettyPrint().then(() => { |
michael@0 | 29 | const prettyText = sp.getText(); |
michael@0 | 30 | ok(prettyText.contains(space)); |
michael@0 | 31 | finish(); |
michael@0 | 32 | }).then(null, error => { |
michael@0 | 33 | ok(false, error); |
michael@0 | 34 | }); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | registerCleanupFunction(function () { |
michael@0 | 38 | Services.prefs.setIntPref("devtools.editor.tabsize", gTabsize); |
michael@0 | 39 | gTabsize = null; |
michael@0 | 40 | }); |