summaryrefslogtreecommitdiff
path: root/browser/devtools/inspector/test/browser_inspector_destroyselection.js
blob: bf24c5e34d07dd835809ce854f309ab4d5ee71ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

function test()
{
  waitForExplicitFinish();
  //ignoreAllUncaughtExceptions();

  let node, iframe, inspector;

  gBrowser.selectedTab = gBrowser.addTab();
  gBrowser.selectedBrowser.addEventListener("load", function onload() {
    gBrowser.selectedBrowser.removeEventListener("load", onload, true);
    waitForFocus(setupTest, content);
  }, true);

  content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_destroyselection.html";

  function setupTest()
  {
    iframe = content.document.querySelector("iframe");
    node = iframe.contentDocument.querySelector("span");
    openInspector(runTests);
  }

  function runTests(aInspector)
  {
    inspector = aInspector;
    inspector.selection.setNode(node);

    iframe.parentNode.removeChild(iframe);
    iframe = null;

    let tmp = {};
    Cu.import("resource:///modules/devtools/LayoutHelpers.jsm", tmp);
    ok(!tmp.LayoutHelpers.isNodeConnected(node), "Node considered as disconnected.");
    ok(!inspector.selection.isConnected(), "Selection considered as disconnected");

    finishUp();
  }

  function finishUp() {
    node = null;
    gBrowser.removeCurrentTab();
    finish();
  }
}