diff --git a/extensions/firefox/content/PdfJs.jsm b/extensions/firefox/content/PdfJs.jsm index 9bc366dd6..e378e8da9 100644 --- a/extensions/firefox/content/PdfJs.jsm +++ b/extensions/firefox/content/PdfJs.jsm @@ -162,11 +162,11 @@ var PdfJs = { // Listen for when pdf.js is completely disabled or a different pdf handler // is chosen. - Services.prefs.addObserver(PREF_DISABLED, this, false); - Services.prefs.addObserver(PREF_DISABLED_PLUGIN_TYPES, this, false); - Services.obs.addObserver(this, TOPIC_PDFJS_HANDLER_CHANGED, false); - Services.obs.addObserver(this, TOPIC_PLUGINS_LIST_UPDATED, false); - Services.obs.addObserver(this, TOPIC_PLUGIN_INFO_UPDATED, false); + Services.prefs.addObserver(PREF_DISABLED, this); + Services.prefs.addObserver(PREF_DISABLED_PLUGIN_TYPES, this); + Services.obs.addObserver(this, TOPIC_PDFJS_HANDLER_CHANGED); + Services.obs.addObserver(this, TOPIC_PLUGINS_LIST_UPDATED); + Services.obs.addObserver(this, TOPIC_PLUGIN_INFO_UPDATED); initializeDefaultPreferences(); }, diff --git a/extensions/firefox/content/PdfjsChromeUtils.jsm b/extensions/firefox/content/PdfjsChromeUtils.jsm index f6e7e44c7..d4cdc2046 100644 --- a/extensions/firefox/content/PdfjsChromeUtils.jsm +++ b/extensions/firefox/content/PdfjsChromeUtils.jsm @@ -73,8 +73,19 @@ var PdfjsChromeUtils = { this._mmg.addMessageListener("PDFJS:Parent:removeEventListener", this); this._mmg.addMessageListener("PDFJS:Parent:updateControlState", this); - // observer to handle shutdown - Services.obs.addObserver(this, "quit-application", false); +//#if !MOZCENTRAL + // The signature of `Services.obs.addObserver` changed in Firefox 55, + // see https://bugzilla.mozilla.org/show_bug.cgi?id=1355216. + // PLEASE NOTE: While the third parameter is now optional, + // omitting it in prior Firefox versions breaks the addon. + var ffVersion = parseInt(Services.appinfo.platformVersion); + if (ffVersion <= 55) { + Services.obs.addObserver(this, "quit-application", false); + return; + } +//#endif + // Observer to handle shutdown. + Services.obs.addObserver(this, "quit-application"); } }, diff --git a/extensions/firefox/content/PdfjsContentUtils.jsm b/extensions/firefox/content/PdfjsContentUtils.jsm index f0eee2b37..5e86a4e64 100644 --- a/extensions/firefox/content/PdfjsContentUtils.jsm +++ b/extensions/firefox/content/PdfjsContentUtils.jsm @@ -45,7 +45,19 @@ var PdfjsContentUtils = { this._mm = Cc["@mozilla.org/childprocessmessagemanager;1"]. getService(Ci.nsISyncMessageSender); this._mm.addMessageListener("PDFJS:Child:refreshSettings", this); - Services.obs.addObserver(this, "quit-application", false); + +//#if !MOZCENTRAL + // The signature of `Services.obs.addObserver` changed in Firefox 55, + // see https://bugzilla.mozilla.org/show_bug.cgi?id=1355216. + // PLEASE NOTE: While the third parameter is now optional, + // omitting it in prior Firefox versions breaks the addon. + var ffVersion = parseInt(Services.appinfo.platformVersion); + if (ffVersion <= 55) { + Services.obs.addObserver(this, "quit-application", false); + return; + } +//#endif + Services.obs.addObserver(this, "quit-application"); } },