Bug 917685 - Catch error thrown by nsILoadContext.associatedWindow; r=mfinkle
authorJim Chen <nchen@mozilla.com>
Wed, 16 Oct 2013 10:51:23 -0400
changeset 165729 0f25523048c391f3b9d37a3369a5e1aba9e8c23a
parent 165728 e5c235dfea0a57a378398df5debf289b2d72871a
child 165730 60185e9edfd42d2d98d8252cb14b78b7e7ce2170
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs917685
milestone27.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 917685 - Catch error thrown by nsILoadContext.associatedWindow; r=mfinkle
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2418,18 +2418,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)