Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 function test() {
9 let inspector, toolbox;
11 waitForExplicitFinish();
13 gBrowser.selectedTab = gBrowser.addTab();
14 gBrowser.selectedBrowser.addEventListener("load", function onload() {
15 gBrowser.selectedBrowser.removeEventListener("load", onload, true);
16 waitForFocus(function() {
17 let target = TargetFactory.forTab(gBrowser.selectedTab);
18 gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
19 startInspectorTests(toolbox);
20 }).then(null, console.error);
21 }, content);
22 }, true);
24 content.location = "data:text/html,<p>p</p>";
26 function startInspectorTests(aToolbox)
27 {
28 toolbox = aToolbox;
29 inspector = toolbox.getCurrentPanel();
30 info("Inspector started");
31 let p = content.document.querySelector("p");
32 inspector.selection.setNode(p);
33 inspector.once("inspector-updated", () => {
34 is(inspector.selection.node, p, "Node selected.");
35 inspector.once("markuploaded", onReload);
36 content.location.reload();
37 });
38 }
40 function onReload() {
41 info("Page reloaded");
42 let p = content.document.querySelector("p");
43 inspector.selection.setNode(p);
44 inspector.once("inspector-updated", () => {
45 is(inspector.selection.node, p, "Node re-selected.");
46 toolbox.destroy();
47 toolbox = inspector = null;
48 gBrowser.removeCurrentTab();
49 finish();
50 });
51 }
52 }