michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: let target = TargetFactory.forTab(gBrowser.selectedTab); michael@0: michael@0: gBrowser.selectedBrowser.addEventListener("load", function onLoad(evt) { michael@0: gBrowser.selectedBrowser.removeEventListener(evt.type, onLoad, true); michael@0: gDevTools.showToolbox(target).then(testReady); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html,test for dynamically registering and unregistering tools"; michael@0: } michael@0: michael@0: function testReady(toolbox) michael@0: { michael@0: ok(toolbox.isReady, "toolbox isReady is set"); michael@0: testDouble(toolbox); michael@0: } michael@0: michael@0: function testDouble(toolbox) michael@0: { michael@0: let target = toolbox.target; michael@0: let toolId = toolbox.currentToolId; michael@0: michael@0: gDevTools.showToolbox(target, toolId).then(function(toolbox2) { michael@0: is(toolbox2, toolbox, "same toolbox"); michael@0: cleanup(toolbox); michael@0: }); michael@0: } michael@0: michael@0: function cleanup(toolbox) michael@0: { michael@0: toolbox.destroy().then(function() { michael@0: gBrowser.removeCurrentTab(); michael@0: finish(); michael@0: }); michael@0: }