michael@0: /* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: function test() { michael@0: let inspector, toolbox; michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function onload() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onload, true); michael@0: waitForFocus(function() { michael@0: let target = TargetFactory.forTab(gBrowser.selectedTab); michael@0: gDevTools.showToolbox(target, "inspector").then(function(toolbox) { michael@0: startInspectorTests(toolbox); michael@0: }).then(null, console.error); michael@0: }, content); michael@0: }, true); michael@0: michael@0: content.location = "http://test1.example.org/browser/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html"; michael@0: michael@0: function startInspectorTests(aToolbox) michael@0: { michael@0: toolbox = aToolbox; michael@0: inspector = toolbox.getCurrentPanel(); michael@0: info("Inspector started"); michael@0: let node = content.document.querySelector("#i1"); michael@0: inspector.selection.setNode(node); michael@0: inspector.once("inspector-updated", () => { michael@0: is(inspector.selection.node, node, "Node selected."); michael@0: inspector.once("markuploaded", onSecondLoad); michael@0: content.location = "http://test2.example.org/browser/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html"; michael@0: }); michael@0: } michael@0: michael@0: function onSecondLoad() { michael@0: info("New page loaded"); michael@0: let node = content.document.querySelector("#i1"); michael@0: inspector.selection.setNode(node); michael@0: michael@0: inspector.once("inspector-updated", () => { michael@0: is(inspector.selection.node, node, "Node re-selected."); michael@0: inspector.once("markuploaded", onThirdLoad); michael@0: content.history.go(-1); michael@0: }); michael@0: } michael@0: michael@0: function onThirdLoad() { michael@0: info("Old page loaded"); michael@0: is(content.location.href, "http://test1.example.org/browser/browser/devtools/inspector/test/browser_inspector_breadcrumbs.html"); michael@0: let node = content.document.querySelector("#i1"); michael@0: inspector.selection.setNode(node); michael@0: inspector.once("inspector-updated", () => { michael@0: is(inspector.selection.node, node, "Node re-selected."); michael@0: inspector.once("markuploaded", onThirdLoad); michael@0: toolbox.destroy(); michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: }); michael@0: } michael@0: } michael@0: michael@0: