Bug 593460 - Tests must properly close the Inspector; f=rcampbell r=sdwilsh
authorMihai Sucan <mihai.sucan@gmail.com>
Wed, 04 May 2011 17:45:40 +0300
changeset 69436 5c711a695cb7eb6065f007829804ab449a90cca5
parent 69435 35aee8daa8bfc86d688ae6da338ac5c3577f0c86
child 69437 ba4d9f25fde6fa9296917cfaec30ae9adb6f4059
push id76
push userbzbarsky@mozilla.com
push dateTue, 05 Jul 2011 17:00:57 +0000
treeherdermozilla-beta@d3a2732c35f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssdwilsh
bugs593460
milestone6.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 593460 - Tests must properly close the Inspector; f=rcampbell r=sdwilsh
browser/base/content/browser.xul
browser/base/content/inspector.js
browser/base/content/test/browser_inspector_initialization.js
browser/base/content/test/browser_inspector_tab_switch.js
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -235,17 +235,17 @@
     <panel id="inspector-tree-panel"
            orient="vertical"
            hidden="true"
            ignorekeys="true"
            noautofocus="true"
            noautohide="true"
            titlebar="normal"
            close="true"
-           onpopuphiding="InspectorUI.closeInspectorUI(true);"
+           onpopuphiding="InspectorUI.closeInspectorUI();"
            label="&inspectPanelTitle.label;">
       <toolbar id="inspector-toolbar"
                nowindowdrag="true">
         <toolbarbutton id="inspector-inspect-toolbutton"
                        label="&inspectButton.label;"
                        accesskey="&inspectButton.accesskey;"
                        class="toolbarbutton-text"
                        command="Inspector:Inspect"/>
--- a/browser/base/content/inspector.js
+++ b/browser/base/content/inspector.js
@@ -342,17 +342,17 @@ var InspectorUI = {
    * Toggle the inspector interface elements on or off.
    *
    * @param aEvent
    *        The event that requested the UI change. Toolbar button or menu.
    */
   toggleInspectorUI: function IUI_toggleInspectorUI(aEvent)
   {
     if (this.isTreePanelOpen) {
-      this.closeInspectorUI(true);
+      this.closeInspectorUI();
     } else {
       this.openInspectorUI();
     }
   },
 
   /**
    * Toggle the status of the inspector, starting or stopping it. Invoked
    * from the toolbar's Inspect button.
@@ -733,28 +733,30 @@ var InspectorUI = {
     }
   },
 
   /**
    * Close inspector UI and associated panels. Unhighlight and stop inspecting.
    * Remove event listeners for document scrolling, resize,
    * tabContainer.TabSelect and others.
    *
-   * @param boolean aClearStore tells if you want the store associated to the
-   * current tab/window to be cleared or not.
+   * @param boolean aKeepStore
+   *        Tells if you want the store associated to the current tab/window to
+   *        be cleared or not. Set this to true to not clear the store, or false
+   *        otherwise.
    */
-  closeInspectorUI: function IUI_closeInspectorUI(aClearStore)
+  closeInspectorUI: function IUI_closeInspectorUI(aKeepStore)
   {
     if (this.closing || !this.win || !this.browser) {
       return;
     }
 
     this.closing = true;
 
-    if (aClearStore) {
+    if (!aKeepStore) {
       InspectorStore.deleteStore(this.winID);
       this.win.removeEventListener("pagehide", this, true);
     } else {
       // Update the store before closing.
       if (this.selection) {
         InspectorStore.setValue(this.winID, "selectedNode",
           this.selection);
       }
@@ -1023,17 +1025,17 @@ var InspectorUI = {
           if (this.isTreePanelOpen && this.isStylePanelOpen &&
               this.isDOMPanelOpen && this.treeLoaded) {
             this.notifyReady();
           }
         break;
       case "TabSelect":
         winID = this.getWindowID(gBrowser.selectedBrowser.contentWindow);
         if (this.isTreePanelOpen && winID != this.winID) {
-          this.closeInspectorUI(false);
+          this.closeInspectorUI(true);
           inspectorClosed = true;
         }
 
         if (winID && InspectorStore.hasID(winID)) {
           if (inspectorClosed && this.closing) {
             Services.obs.addObserver(function () {
               InspectorUI.openInspectorUI();
             }, "inspector-closed", false);
--- a/browser/base/content/test/browser_inspector_initialization.js
+++ b/browser/base/content/test/browser_inspector_initialization.js
@@ -51,17 +51,17 @@ function runInspectorTests()
   Services.obs.removeObserver(runInspectorTests, "inspector-opened", false);
   Services.obs.addObserver(finishInspectorTests, "inspector-closed", false);
   let iframe = document.getElementById("inspector-tree-iframe");
   is(InspectorUI.treeIFrame, iframe, "Inspector IFrame matches");
   ok(InspectorUI.inspecting, "Inspector is highlighting");
   ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
   ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
   ok(InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is open");
-  InspectorUI.closeInspectorUI(true);
+  InspectorUI.closeInspectorUI();
 }
 
 function finishInspectorTests()
 {
   Services.obs.removeObserver(finishInspectorTests, "inspector-closed", false);
   ok(!InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is closed");
   ok(!InspectorUI.isStylePanelOpen, "Inspector Style Panel is closed");
   ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed");
--- a/browser/base/content/test/browser_inspector_tab_switch.js
+++ b/browser/base/content/test/browser_inspector_tab_switch.js
@@ -152,16 +152,17 @@ function inspectorTabUnload1(evt)
   tab1window = tab1 = tab2 = div = null;
 
   // Make sure the Inspector is still open and that the state is correct.
   ok(!InspectorUI.inspecting, "Inspector is not highlighting");
   ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
   ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
   is(InspectorStore.length, 1, "InspectorStore.length = 1");
 
+  InspectorUI.closeInspectorUI();
   gBrowser.removeCurrentTab();
   finish();
 }
 
 function test()
 {
   waitForExplicitFinish();