michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // A for-of loop in Web Console code can loop over a content NodeList. michael@0: michael@0: const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-for-of.html"; michael@0: michael@0: function test() { michael@0: addTab(TEST_URI); michael@0: browser.addEventListener("load", function onLoad() { michael@0: browser.removeEventListener("load", onLoad, true); michael@0: openConsole(null, testForOf); michael@0: }, true); michael@0: } michael@0: michael@0: function testForOf(hud) { michael@0: var jsterm = hud.jsterm; michael@0: jsterm.execute("{ [x.tagName for (x of document.body.childNodes) if (x.nodeType === 1)].join(' '); }", michael@0: (node) => { michael@0: ok(/H1 DIV H2 P/.test(node.textContent), michael@0: "for-of loop should find all top-level nodes"); michael@0: finishTest(); michael@0: }); michael@0: }