michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: let node, iframe, inspector; michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function onload() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onload, true); michael@0: waitForFocus(setupTest, content); michael@0: }, true); michael@0: michael@0: content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_destroyselection.html"; michael@0: michael@0: function setupTest() michael@0: { michael@0: iframe = content.document.querySelector("iframe"); michael@0: node = iframe.contentDocument.querySelector("span"); michael@0: openInspector(runTests); michael@0: } michael@0: michael@0: function runTests(aInspector) michael@0: { michael@0: inspector = aInspector; michael@0: inspector.selection.setNode(node); michael@0: michael@0: inspector.once("inspector-updated", () => { michael@0: iframe.parentNode.removeChild(iframe); michael@0: iframe = null; michael@0: michael@0: let tmp = {}; michael@0: Cu.import("resource://gre/modules/devtools/LayoutHelpers.jsm", tmp); michael@0: let lh = new tmp.LayoutHelpers(window.content); michael@0: ok(!lh.isNodeConnected(node), "Node considered as disconnected."); michael@0: ok(!inspector.selection.isConnected(), "Selection considered as disconnected"); michael@0: michael@0: inspector.once("inspector-updated", () => { michael@0: finishUp(); michael@0: }); michael@0: }); michael@0: } michael@0: michael@0: function finishUp() { michael@0: node = inspector = null; michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: } michael@0: } michael@0: