browser/devtools/inspector/test/browser_inspector_destroyselection.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test()
     5 {
     6   waitForExplicitFinish();
     8   let node, iframe, inspector;
    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);
    16   content.location = "http://mochi.test:8888/browser/browser/devtools/inspector/test/browser_inspector_destroyselection.html";
    18   function setupTest()
    19   {
    20     iframe = content.document.querySelector("iframe");
    21     node = iframe.contentDocument.querySelector("span");
    22     openInspector(runTests);
    23   }
    25   function runTests(aInspector)
    26   {
    27     inspector = aInspector;
    28     inspector.selection.setNode(node);
    30     inspector.once("inspector-updated", () => {
    31       iframe.parentNode.removeChild(iframe);
    32       iframe = null;
    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");
    40       inspector.once("inspector-updated", () => {
    41         finishUp();
    42       });
    43     });
    44   }
    46   function finishUp() {
    47     node = inspector = null;
    48     gBrowser.removeCurrentTab();
    49     finish();
    50   }
    51 }

mercurial