From f957821a12c5d201acc1ba314cfeb8a8f3bfb8b8 Mon Sep 17 00:00:00 2001 From: Georg Koppen Date: Thu, 7 Nov 2019 14:27:14 +0000 Subject: [PATCH] Bug 31573: Catch SessionStore.jsm exception This is a backport of the fix for Mozilla's bug 1591259. --- dom/push/PushComponents.jsm | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dom/push/PushComponents.jsm b/dom/push/PushComponents.jsm index 99b1d2baffac9..fb2a601bc88d9 100644 --- a/dom/push/PushComponents.jsm +++ b/dom/push/PushComponents.jsm @@ -88,12 +88,28 @@ PushServiceBase.prototype = { } if (topic === "sessionstore-windows-restored") { Services.obs.removeObserver(this, "sessionstore-windows-restored"); - this._handleReady(); + try { + this._handleReady(); + } 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; + } + } return; } if (topic === "android-push-service") { // Load PushService immediately. - this._handleReady(); + try { + this._handleReady(); + } 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; + } + } } }, -- GitLab