Bug 706092 - Inspector : can't close inspector pane; r=dcamp

This commit is contained in:
Rob Campbell 2012-08-02 13:42:00 +03:00
parent b6483fed80
commit 2286cdd868
2 changed files with 29 additions and 4 deletions

View File

@ -519,7 +519,11 @@ TreePanel.prototype = {
*/ */
closeEditor: function TP_closeEditor() closeEditor: function TP_closeEditor()
{ {
if (!this.treeBrowserDocument) // already closed, bug 706092
return;
let editor = this.treeBrowserDocument.getElementById("attribute-editor"); let editor = this.treeBrowserDocument.getElementById("attribute-editor");
let editorInput = let editorInput =
this.treeBrowserDocument.getElementById("attribute-editor-input"); this.treeBrowserDocument.getElementById("attribute-editor-input");

View File

@ -11,7 +11,11 @@ let div;
let editorTestSteps; let editorTestSteps;
function doNextStep() { function doNextStep() {
try {
editorTestSteps.next(); editorTestSteps.next();
} catch(exception) {
info("caught:", exception);
}
} }
function setupEditorTests() function setupEditorTests()
@ -214,16 +218,33 @@ function doEditorTestSteps()
yield; // End of Step 7 yield; // End of Step 7
// Step 8: validate that the editor was closed and that the editing was not saved // Step 8: validate that the editor was closed and that the editing was not saved
ok(!treePanel.editingContext, "Step 8: editor session ended"); ok(!treePanel.editingContext, "Step 8: editor session ended");
editorVisible = editor.classList.contains("editing"); editorVisible = editor.classList.contains("editing");
ok(!editorVisible, "editor popup hidden"); ok(!editorVisible, "editor popup hidden");
is(div.getAttribute("id"), "Hello World", "`id` attribute-value *not* updated"); is(div.getAttribute("id"), "Hello World", "`id` attribute-value *not* updated");
is(attrValNode_id.innerHTML, "Hello World", "attribute-value node in HTML panel *not* updated"); is(attrValNode_id.innerHTML, "Hello World", "attribute-value node in HTML panel *not* updated");
executeSoon(doNextStep);
// End of Step 8 yield; // End of Step 8
executeSoon(finishUp);
// Step 9: Open the Editor and verify that closing the tree panel does not make the
// Inspector go cray-cray.
executeSoon(function() {
// firing 2 clicks right in a row to simulate a double-click
EventUtils.synthesizeMouse(attrValNode_id, 2, 2, {clickCount: 2}, attrValNode_id.ownerDocument.defaultView);
doNextStep();
});
yield; // End of Step 9
ok(treePanel.editingContext, "Step 9: editor session started");
editorVisible = editor.classList.contains("editing");
ok(editorVisible, "editor popup is visible");
executeSoon(function() {
InspectorUI.toggleHTMLPanel();
finishUp();
});
} }
function finishUp() { function finishUp() {