Merge pull request #8311 from Snuffleupagus/bug-1356569

[Firefox addon] Upstream changes from: Bug 1356569 - Remove optional trailing parameters (issue 8310)
This commit is contained in:
Yury Delendik 2017-04-18 14:19:21 -05:00 committed by GitHub
commit bc20181a1e
3 changed files with 31 additions and 8 deletions

View File

@ -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();
},

View File

@ -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");
}
},

View File

@ -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");
}
},