Bug 633196 - Object details don't open in the Web Console, when trying a second time; f=rcampbell r=dolske approval2.0=dolske

This commit is contained in:
Mihai Sucan 2011-02-14 11:00:21 -08:00
parent 455787745c
commit 4c111113d2
3 changed files with 18 additions and 17 deletions

View File

@ -4071,10 +4071,9 @@ JSTerm.prototype = {
{
let self = this;
let propPanel;
// The property panel has two buttons:
// 1. `Update`: reexecutes the string executed on the command line. The
// The property panel has one button:
// `Update`: reexecutes the string executed on the command line. The
// result will be inspected by this panel.
// 2. `Close`: destroys the panel.
let buttons = [];
// If there is a evalString passed to this function, then add a `Update`
@ -4102,22 +4101,14 @@ JSTerm.prototype = {
});
}
buttons.push({
label: HUDService.getStr("close.button"),
accesskey: HUDService.getStr("close.accesskey"),
class: "jsPropertyPanelCloseButton",
oncommand: function () {
propPanel.destroy();
aAnchor._panelOpen = false;
}
});
let doc = self.parentNode.ownerDocument;
let parent = doc.getElementById("mainPopupSet");
let title = (aEvalString
? HUDService.getFormatStr("jsPropertyInspectTitle", [aEvalString])
: HUDService.getStr("jsPropertyTitle"));
propPanel = new PropertyPanel(parent, doc, title, aOutputObject, buttons);
propPanel.linkNode = aAnchor;
let panel = propPanel.panel;
panel.openPopup(aAnchor, "after_pointer", 0, 0, false, false);

View File

@ -430,7 +430,8 @@ function PropertyPanel(aParent, aDocument, aTitle, aObject, aButtons)
label: aTitle,
titlebar: "normal",
noautofocus: "true",
noautohide: "true"
noautohide: "true",
close: "true",
});
// Create the tree.
@ -484,6 +485,12 @@ function PropertyPanel(aParent, aDocument, aTitle, aObject, aButtons)
self.panel.removeEventListener("popupshown", onPopupShow, false);
self.tree.view = self.treeView;
}, false);
this.panel.addEventListener("popuphidden", function onPopupHide()
{
self.panel.removeEventListener("popuphidden", onPopupHide, false);
self.destroy();
}, false);
}
/**
@ -494,9 +501,13 @@ function PropertyPanel(aParent, aDocument, aTitle, aObject, aButtons)
*/
PropertyPanel.prototype.destroy = function PP_destroy()
{
this.panel.hidePopup();
this.panel.parentNode.removeChild(this.panel);
this.treeView = null;
this.panel = null;
this.tree = null;
if (this.linkNode) {
this.linkNode._panelOpen = false;
this.linkNode = null;
}
}

View File

@ -117,8 +117,7 @@ function properyPanelShown(aEvent) {
executeSoon(function() {
aEvent.target.addEventListener("popuphidden", propertyPanelHidden, false);
let closeButton = aEvent.target.querySelector(".jsPropertyPanelCloseButton");
closeButton.doCommand();
aEvent.target.hidePopup();
});
}