Bug 647951 - Fix for "window.top.XULBrowserWindow is null" error. r=mak
authorOHZEKI Tetsuharu <saneyuki.s.snyk@gmail.com>
Wed, 28 Mar 2012 20:35:13 +0200
changeset 90548 a313f75c607c1c15c743038ff18caa6c2393a90a
parent 90547 97377dc127550fe8c0a3dff0843d4de4bbb02ad6
child 90549 8e1f2165d52ec92e8d350ed66867c7fdff395a3f
push idunknown
push userunknown
push dateunknown
reviewersmak
bugs647951
milestone14.0a1
Bug 647951 - Fix for "window.top.XULBrowserWindow is null" error. r=mak
browser/components/places/content/sidebarUtils.js
--- a/browser/components/places/content/sidebarUtils.js
+++ b/browser/components/places/content/sidebarUtils.js
@@ -131,11 +131,16 @@ var SidebarUtils = {
       else
         this.setMouseoverURL("");
     }
     else
       this.setMouseoverURL("");
   },
 
   setMouseoverURL: function SU_setMouseoverURL(aURL) {
-    window.top.XULBrowserWindow.setOverLink(aURL, null);
+    // When the browser window is closed with an open sidebar, the sidebar
+    // unload event happens after the browser's one.  In this case
+    // top.XULBrowserWindow has been nullified already.
+    if (top.XULBrowserWindow) {
+      top.XULBrowserWindow.setOverLink(aURL, null);
+    }
   }
 };