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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | // A for-of loop in Web Console code can loop over a content NodeList. |
michael@0 | 5 | |
michael@0 | 6 | const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-for-of.html"; |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | addTab(TEST_URI); |
michael@0 | 10 | browser.addEventListener("load", function onLoad() { |
michael@0 | 11 | browser.removeEventListener("load", onLoad, true); |
michael@0 | 12 | openConsole(null, testForOf); |
michael@0 | 13 | }, true); |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | function testForOf(hud) { |
michael@0 | 17 | var jsterm = hud.jsterm; |
michael@0 | 18 | jsterm.execute("{ [x.tagName for (x of document.body.childNodes) if (x.nodeType === 1)].join(' '); }", |
michael@0 | 19 | (node) => { |
michael@0 | 20 | ok(/H1 DIV H2 P/.test(node.textContent), |
michael@0 | 21 | "for-of loop should find all top-level nodes"); |
michael@0 | 22 | finishTest(); |
michael@0 | 23 | }); |
michael@0 | 24 | } |