Bug 1591259, insert catch block before accessing PushService to avoid exception during session-windows-restored r=mconley
authorEmma Malysz <emalysz@mozilla.com>
Wed, 06 Nov 2019 17:36:45 +0000
changeset 500895 da87ab43340f87e85b4a0df593df957d7dbf18be
parent 500894 c8f4de2596bcd6387c84ca02d59389a4dd309c89
child 500896 4d77157a8980ce8842f53ef8a8911aa2982c0321
push id114166
push userapavel@mozilla.com
push dateThu, 07 Nov 2019 10:04:01 +0000
treeherdermozilla-inbound@d271c572a9bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1591259
milestone72.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 1591259, insert catch block before accessing PushService to avoid exception during session-windows-restored r=mconley Differential Revision: https://phabricator.services.mozilla.com/D52053
browser/components/BrowserGlue.jsm
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -2108,17 +2108,25 @@ BrowserGlue.prototype = {
         "permissions.eventTelemetry.enabled",
         this._togglePermissionPromptTelemetry
       );
       this._togglePermissionPromptTelemetry();
     });
 
     // Begin listening for incoming push messages.
     Services.tm.idleDispatchToMainThread(() => {
-      PushService.wrappedJSObject.ensureReady();
+      try {
+        PushService.wrappedJSObject.ensureReady();
+      } catch (ex) {
+        // NS_ERROR_NOT_AVAILABLE will get thrown for the PushService getter
+        // if the PushService is disabled.
+        if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) {
+          throw ex;
+        }
+      }
     });
 
     Services.tm.idleDispatchToMainThread(() => {
       this._recordContentBlockingTelemetry();
     });
 
     Services.tm.idleDispatchToMainThread(() => {
       this._recordContentBlockerTelemetry();