Skip PdfJs.enabled check in bootstrap-enabled.

If we only invoke the bootstrap-enabled script when PdfJs.enabled is
true, then we don't need to check it again in the script.

This avoids a sync IPC call to the parent process.

It also keeps PdfJs.jsm from importing PdfjsContentUtils.jsm in the
child process until it is actually needed, which is one steps towards
not loading it until it is really needed.
This commit is contained in:
Andrew McCreight 2017-03-30 13:41:11 -07:00
parent d804881151
commit 740e1ab450
2 changed files with 6 additions and 6 deletions

View File

@ -173,9 +173,9 @@ var PdfJs = {
updateRegistration: function updateRegistration() {
if (this.enabled) {
this._ensureRegistered();
this.ensureRegistered();
} else {
this._ensureUnregistered();
this.ensureUnregistered();
}
},
@ -188,7 +188,7 @@ var PdfJs = {
Services.obs.removeObserver(this, TOPIC_PLUGIN_INFO_UPDATED);
this._initialized = false;
}
this._ensureUnregistered();
this.ensureUnregistered();
},
_migrate: function migrate() {
@ -307,7 +307,7 @@ var PdfJs = {
return !enabledPluginFound;
},
_ensureRegistered: function _ensureRegistered() {
ensureRegistered: function ensureRegistered() {
if (this._registered) {
return;
}
@ -318,7 +318,7 @@ var PdfJs = {
this._registered = true;
},
_ensureUnregistered: function _ensureUnregistered() {
ensureUnregistered: function ensureUnregistered() {
if (!this._registered) {
return;
}

View File

@ -27,5 +27,5 @@ Components.utils.import("resource://pdf.js/PdfJs.jsm");
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
// register various pdfjs factories that hook us into content loading.
PdfJs.updateRegistration();
PdfJs.ensureRegistered();
}