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 = "http://test1.example.org/browser/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html";
26 function startInspectorTests(aToolbox)
27 {
28 toolbox = aToolbox;
29 inspector = toolbox.getCurrentPanel();
30 info("Inspector started");
31 let node = content.document.querySelector("#i1");
32 inspector.selection.setNode(node);
33 inspector.once("inspector-updated", () => {
34 is(inspector.selection.node, node, "Node selected.");
35 inspector.once("markuploaded", onSecondLoad);
36 content.location = "http://test2.example.org/browser/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html";
37 });
38 }
40 function onSecondLoad() {
41 info("New page loaded");
42 let node = content.document.querySelector("#i1");
43 inspector.selection.setNode(node);
45 inspector.once("inspector-updated", () => {
46 is(inspector.selection.node, node, "Node re-selected.");
47 inspector.once("markuploaded", onThirdLoad);
48 content.history.go(-1);
49 });
50 }
52 function onThirdLoad() {
53 info("Old page loaded");
54 is(content.location.href, "http://test1.example.org/browser/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html");
55 let node = content.document.querySelector("#i1");
56 inspector.selection.setNode(node);
57 inspector.once("inspector-updated", () => {
58 is(inspector.selection.node, node, "Node re-selected.");
59 inspector.once("markuploaded", onThirdLoad);
60 toolbox.destroy();
61 gBrowser.removeCurrentTab();
62 finish();
63 });
64 }
65 }