Bug 814592 - [toolbox] Tilt toggle command is broken, r=jwalker

This commit is contained in:
Victor Porof 2012-11-23 10:54:42 +02:00
parent e75efbd155
commit 67207c8831
3 changed files with 8 additions and 13 deletions

View File

@ -30,7 +30,9 @@ gcli.addCommand({
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
let Tilt = TiltManager.getTiltForBrowser(chromeWindow);
Tilt.initializeForCurrentTab();
if (!Tilt.currentInstance) {
Tilt.toggle();
}
}
});
@ -45,15 +47,8 @@ gcli.addCommand({
hidden: true,
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
if (TiltManager._instances.has(chromeWindow)) {
let Tilt = TiltManager.getTiltForBrowser(chromeWindow);
Tilt.destroy(Tilt.currentWindowId);
}
else {
let Tilt = TiltManager.getTiltForBrowser(chromeWindow);
Tilt.initializeForCurrentTab();
}
Tilt.toggle();
}
});

View File

@ -93,9 +93,9 @@ this.Tilt = function Tilt(aWindow)
Tilt.prototype = {
/**
* Initializes a visualizer for the current tab.
* Initializes a visualizer for the current tab or closes it if already open.
*/
initializeForCurrentTab: function T_initializeForCurrentTab()
toggle: function T_toggle()
{
let contentWindow = this.chromeWindow.gBrowser.selectedBrowser.contentWindow;
let id = this.currentWindowId;

View File

@ -151,7 +151,7 @@ function createTilt(callbacks, close, suddenDeath) {
info("Attempting to start Tilt.");
Services.obs.addObserver(onTiltOpen, INITIALIZING, false);
Tilt.initializeForCurrentTab();
Tilt.toggle();
function onTiltOpen() {
info("Tilt was opened.");