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,<p>test inspect() in Scratchpad</p>"; |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | function runTests() |
michael@0 | 19 | { |
michael@0 | 20 | let sp = gScratchpadWindow.Scratchpad; |
michael@0 | 21 | |
michael@0 | 22 | sp.setText("({ a: 'foobarBug636725' })"); |
michael@0 | 23 | |
michael@0 | 24 | sp.inspect().then(function() { |
michael@0 | 25 | let sidebar = sp.sidebar; |
michael@0 | 26 | ok(sidebar.visible, "sidebar is open"); |
michael@0 | 27 | |
michael@0 | 28 | |
michael@0 | 29 | let found = false; |
michael@0 | 30 | |
michael@0 | 31 | outer: for (let scope of sidebar.variablesView) { |
michael@0 | 32 | for (let [, obj] of scope) { |
michael@0 | 33 | for (let [, prop] of obj) { |
michael@0 | 34 | if (prop.name == "a" && prop.value == "foobarBug636725") { |
michael@0 | 35 | found = true; |
michael@0 | 36 | break outer; |
michael@0 | 37 | } |
michael@0 | 38 | } |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | ok(found, "found the property"); |
michael@0 | 43 | |
michael@0 | 44 | let tabbox = sidebar._sidebar._tabbox; |
michael@0 | 45 | is(tabbox.width, 300, "Scratchpad sidebar width is correct"); |
michael@0 | 46 | ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible"); |
michael@0 | 47 | sidebar.hide(); |
michael@0 | 48 | ok(tabbox.hasAttribute("hidden"), "Scratchpad sidebar hidden"); |
michael@0 | 49 | sp.inspect().then(function() { |
michael@0 | 50 | is(tabbox.width, 300, "Scratchpad sidebar width is still correct"); |
michael@0 | 51 | ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible again"); |
michael@0 | 52 | finish(); |
michael@0 | 53 | }); |
michael@0 | 54 | }); |
michael@0 | 55 | } |