Bug 917685 - Catch error thrown by nsILoadContext.associatedWindow. r=mfinkle, a=akeybl
authorJim Chen <nchen@mozilla.com>
Wed, 16 Oct 2013 10:51:23 -0400
changeset 155803 a93bf8a2d13702034a501185bcb26dd2d0600a24
parent 155802 381e38e1d23d79f4d9936bb7a174c94419186425
child 155804 420a47d418ec92e81efc45d3de3516c619b62d7d
push id4428
push userryanvm@gmail.com
push dateThu, 17 Oct 2013 16:54:16 +0000
treeherdermozilla-aurora@9ca74e12ff65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, akeybl
bugs917685
milestone26.0a2
Bug 917685 - Catch error thrown by nsILoadContext.associatedWindow. r=mfinkle, a=akeybl
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2415,18 +2415,23 @@ var DesktopUserAgent = {
       } catch (ex) { }
     }
 
     return null;
   },
 
   _getWindowForRequest: function ua_getWindowForRequest(aRequest) {
     let loadContext = this._getRequestLoadContext(aRequest);
-    if (loadContext)
-      return loadContext.associatedWindow;
+    if (loadContext) {
+      try {
+        return loadContext.associatedWindow;
+      } catch (e) {
+        // loadContext.associatedWindow can throw when there's no window
+      }
+    }
     return null;
   },
 
   observe: function ua_observe(aSubject, aTopic, aData) {
     if (aTopic === "DesktopMode:Change") {
       let args = JSON.parse(aData);
       let tab = BrowserApp.getTabForId(args.tabId);
       if (tab != null)