Bug 473447: help key opens blank Help window; r=stefanh, sr=neil
authorKarsten Düsterloh <mnyromyr@tprac.de>
Sun, 18 Jan 2009 23:16:43 +0100
changeset 1675 13557e287fe63782d1f886b2a64553e610358c53
parent 1674 629517ab551c0aa99862596fbfc7f475fade6bc4
child 1676 4c6563dcabef76c23e3022f41634bdc200b751fb
push idunknown
push userunknown
push dateunknown
reviewersstefanh, neil
bugs473447
Bug 473447: help key opens blank Help window; r=stefanh, sr=neil
suite/common/bindings/prefwindow.xml
--- a/suite/common/bindings/prefwindow.xml
+++ b/suite/common/bindings/prefwindow.xml
@@ -431,43 +431,49 @@
         <![CDATA[
           const wm = Components.classes['@mozilla.org/appshell/window-mediator;1']
                                .getService(Components.interfaces.nsIWindowMediator);
           const iterator = wm.getEnumerator("mozilla:help");
           var topWindow = null;
           var aWindow;
 
           // Loop through help windows looking for one with selected helpFileURI
-          while (iterator.hasMoreElements()) {
+          while (iterator.hasMoreElements())
+          {
             aWindow = iterator.getNext();
             if (aWindow.getHelpFileURI() == helpFileURI)
               topWindow = aWindow;
           }
           return topWindow;
         ]]>
         </body>
       </method>
 
     <!-- copied from contextHelp.js
          Opens up the Help Viewer with the specified topic and helpFileURI. -->
       <method name="openHelp">
         <parameter name="topic"/>
         <parameter name="helpFileURI"/>
         <body>
         <![CDATA[
+          // Empty help windows are not helpful...
+          if (!helpFileURI)
+            return;
+
           // Try to find previously opened help.
           var topWindow = this.locateHelpWindow(helpFileURI);
-
-          if (topWindow) {
-          // Open topic in existing window.
+          if (topWindow)
+          {
+            // Open topic in existing window.
             topWindow.focus();
             topWindow.displayTopic(topic);
           }
-          else {
-          // Open topic in new window.
+          else
+          {
+            // Open topic in new window.
             const params = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
                                      .createInstance(Components.interfaces.nsIDialogParamBlock);
             params.SetNumberStrings(2);
             params.SetString(0, helpFileURI);
             params.SetString(1, topic);
             const ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
                                  .getService(Components.interfaces.nsIWindowWatcher);
             ww.openWindow(null, "chrome://help/content/help.xul", "_blank", "chrome,all,alwaysRaised,dialog=no", params);