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