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

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

mercurial