|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() |
|
5 { |
|
6 waitForExplicitFinish(); |
|
7 |
|
8 let node, iframe, inspector; |
|
9 |
|
10 gBrowser.selectedTab = gBrowser.addTab(); |
|
11 gBrowser.selectedBrowser.addEventListener("load", function onload() { |
|
12 gBrowser.selectedBrowser.removeEventListener("load", onload, true); |
|
13 waitForFocus(setupTest, content); |
|
14 }, true); |
|
15 |
|
16 content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_destroyselection.html"; |
|
17 |
|
18 function setupTest() |
|
19 { |
|
20 iframe = content.document.querySelector("iframe"); |
|
21 node = iframe.contentDocument.querySelector("span"); |
|
22 openInspector(runTests); |
|
23 } |
|
24 |
|
25 function runTests(aInspector) |
|
26 { |
|
27 inspector = aInspector; |
|
28 inspector.selection.setNode(node); |
|
29 |
|
30 inspector.once("inspector-updated", () => { |
|
31 iframe.parentNode.removeChild(iframe); |
|
32 iframe = null; |
|
33 |
|
34 let tmp = {}; |
|
35 Cu.import("resource://gre/modules/devtools/LayoutHelpers.jsm", tmp); |
|
36 let lh = new tmp.LayoutHelpers(window.content); |
|
37 ok(!lh.isNodeConnected(node), "Node considered as disconnected."); |
|
38 ok(!inspector.selection.isConnected(), "Selection considered as disconnected"); |
|
39 |
|
40 inspector.once("inspector-updated", () => { |
|
41 finishUp(); |
|
42 }); |
|
43 }); |
|
44 } |
|
45 |
|
46 function finishUp() { |
|
47 node = inspector = null; |
|
48 gBrowser.removeCurrentTab(); |
|
49 finish(); |
|
50 } |
|
51 } |
|
52 |