From 2286cdd8689dea73a8d2591be5af500648c41f1b Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 2 Aug 2012 13:42:00 +0300 Subject: [PATCH] Bug 706092 - Inspector : can't close inspector pane; r=dcamp --- browser/devtools/highlighter/TreePanel.jsm | 4 +++ .../test/browser_inspector_editor.js | 29 ++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/browser/devtools/highlighter/TreePanel.jsm b/browser/devtools/highlighter/TreePanel.jsm index 55de7dc6f03..0761fa2ff82 100644 --- a/browser/devtools/highlighter/TreePanel.jsm +++ b/browser/devtools/highlighter/TreePanel.jsm @@ -519,7 +519,11 @@ TreePanel.prototype = { */ closeEditor: function TP_closeEditor() { + if (!this.treeBrowserDocument) // already closed, bug 706092 + return; + let editor = this.treeBrowserDocument.getElementById("attribute-editor"); + let editorInput = this.treeBrowserDocument.getElementById("attribute-editor-input"); diff --git a/browser/devtools/highlighter/test/browser_inspector_editor.js b/browser/devtools/highlighter/test/browser_inspector_editor.js index 3099bad1b08..82ba4312392 100644 --- a/browser/devtools/highlighter/test/browser_inspector_editor.js +++ b/browser/devtools/highlighter/test/browser_inspector_editor.js @@ -11,7 +11,11 @@ let div; let editorTestSteps; function doNextStep() { - editorTestSteps.next(); + try { + editorTestSteps.next(); + } catch(exception) { + info("caught:", exception); + } } function setupEditorTests() @@ -214,16 +218,33 @@ function doEditorTestSteps() yield; // End of Step 7 - // Step 8: validate that the editor was closed and that the editing was not saved ok(!treePanel.editingContext, "Step 8: editor session ended"); editorVisible = editor.classList.contains("editing"); ok(!editorVisible, "editor popup hidden"); 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"); + executeSoon(doNextStep); - // End of Step 8 - executeSoon(finishUp); + yield; // End of Step 8 + + // 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() {