diff -r 000000000000 -r 6474c204b198 browser/devtools/inspector/test/browser_inspector_reload.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/devtools/inspector/test/browser_inspector_reload.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,52 @@ +/* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +function test() { + let inspector, toolbox; + + waitForExplicitFinish(); + + gBrowser.selectedTab = gBrowser.addTab(); + gBrowser.selectedBrowser.addEventListener("load", function onload() { + gBrowser.selectedBrowser.removeEventListener("load", onload, true); + waitForFocus(function() { + let target = TargetFactory.forTab(gBrowser.selectedTab); + gDevTools.showToolbox(target, "inspector").then(function(toolbox) { + startInspectorTests(toolbox); + }).then(null, console.error); + }, content); + }, true); + + content.location = "data:text/html,

p

"; + + function startInspectorTests(aToolbox) + { + toolbox = aToolbox; + inspector = toolbox.getCurrentPanel(); + info("Inspector started"); + let p = content.document.querySelector("p"); + inspector.selection.setNode(p); + inspector.once("inspector-updated", () => { + is(inspector.selection.node, p, "Node selected."); + inspector.once("markuploaded", onReload); + content.location.reload(); + }); + } + + function onReload() { + info("Page reloaded"); + let p = content.document.querySelector("p"); + inspector.selection.setNode(p); + inspector.once("inspector-updated", () => { + is(inspector.selection.node, p, "Node re-selected."); + toolbox.destroy(); + toolbox = inspector = null; + gBrowser.removeCurrentTab(); + finish(); + }); + } +}