browser/devtools/inspector/test/browser_inspector_destroyselection.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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