[Basilisk] Update pdf.js to version 1.6.467 from Firefox 53.0.2

This commit is contained in:
Basilisk-Dev 2023-09-11 21:58:45 -04:00 committed by roytam1
commit 328408759a
15 changed files with 63242 additions and 69243 deletions

View file

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint esnext:true */
/* globals Components, Services, XPCOMUtils, PdfjsChromeUtils,
PdfjsContentUtils, PdfStreamConverter */
@ -52,6 +51,23 @@ XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsChromeUtils',
'resource://pdf.js/PdfjsChromeUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
'resource://pdf.js/PdfjsContentUtils.jsm');
function getBoolPref(aPref, aDefaultValue) {
try {
return Services.prefs.getBoolPref(aPref);
} catch (ex) {
return aDefaultValue;
}
}
function getIntPref(aPref, aDefaultValue) {
try {
return Services.prefs.getIntPref(aPref);
} catch (ex) {
return aDefaultValue;
}
}
function isDefaultHandler() {
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
return PdfjsContentUtils.isDefaultHandlerApp();
@ -76,6 +92,7 @@ function initializeDefaultPreferences() {
"useOnlyCssZoom": false,
"externalLinkTarget": 0,
"enhanceTextSelection": false,
"renderer": "canvas",
"renderInteractiveForms": false,
"disablePageLabels": false
}
@ -155,7 +172,7 @@ var PdfJs = {
}
this._initialized = true;
if (!Services.prefs.getBoolPref(PREF_DISABLED, true)) {
if (!getBoolPref(PREF_DISABLED, true)) {
this._migrate();
}
@ -180,11 +197,11 @@ var PdfJs = {
uninit: function uninit() {
if (this._initialized) {
Services.prefs.removeObserver(PREF_DISABLED, this, false);
Services.prefs.removeObserver(PREF_DISABLED_PLUGIN_TYPES, this, false);
Services.obs.removeObserver(this, TOPIC_PDFJS_HANDLER_CHANGED, false);
Services.obs.removeObserver(this, TOPIC_PLUGINS_LIST_UPDATED, false);
Services.obs.removeObserver(this, TOPIC_PLUGIN_INFO_UPDATED, false);
Services.prefs.removeObserver(PREF_DISABLED, this);
Services.prefs.removeObserver(PREF_DISABLED_PLUGIN_TYPES, this);
Services.obs.removeObserver(this, TOPIC_PDFJS_HANDLER_CHANGED);
Services.obs.removeObserver(this, TOPIC_PLUGINS_LIST_UPDATED);
Services.obs.removeObserver(this, TOPIC_PLUGIN_INFO_UPDATED);
this._initialized = false;
}
this._ensureUnregistered();
@ -192,7 +209,7 @@ var PdfJs = {
_migrate: function migrate() {
const VERSION = 2;
var currentVersion = Services.prefs.getIntPref(PREF_MIGRATION_VERSION, 0);
var currentVersion = getIntPref(PREF_MIGRATION_VERSION, 0);
if (currentVersion >= VERSION) {
return;
}
@ -267,7 +284,7 @@ var PdfJs = {
* @return {boolean} Whether or not it's enabled.
*/
get enabled() {
var disabled = Services.prefs.getBoolPref(PREF_DISABLED, true);
var disabled = getBoolPref(PREF_DISABLED, true);
if (disabled) {
return false;
}