Skip to content

Commit

Permalink
Merge pull request #19556 from Snuffleupagus/_initializeViewerCompone…
Browse files Browse the repository at this point in the history
…nts-more-local-vars

Use more local variables in `PDFViewerApplication._initializeViewerComponents`
  • Loading branch information
Snuffleupagus authored Feb 27, 2025
2 parents 4e76a78 + cec32c6 commit 21829f4
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ const PDFViewerApplication = {
* @private
*/
async _initializeViewerComponents() {
const { appConfig, externalServices, l10n } = this;
const { appConfig, externalServices, l10n, mlManager } = this;
const abortSignal = this._globalAbortController.signal;

const eventBus =
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
Expand All @@ -391,7 +392,7 @@ const PDFViewerApplication = {
)
: new EventBus();
this.eventBus = AppOptions.eventBus = eventBus;
this.mlManager?.setEventBus(eventBus, this._globalAbortController.signal);
mlManager?.setEventBus(eventBus, abortSignal);

this.overlayManager = new OverlayManager();

Expand Down Expand Up @@ -470,10 +471,7 @@ const PDFViewerApplication = {
null,
this.overlayManager,
l10n,
externalServices.createSignatureStorage(
eventBus,
this._globalAbortController.signal
),
externalServices.createSignatureStorage(eventBus, abortSignal),
eventBus
)
: null;
Expand Down Expand Up @@ -510,8 +508,8 @@ const PDFViewerApplication = {
enableDetailCanvas: AppOptions.get("enableDetailCanvas"),
enablePermissions: AppOptions.get("enablePermissions"),
pageColors,
mlManager: this.mlManager,
abortSignal: this._globalAbortController.signal,
mlManager,
abortSignal,
enableHWA,
supportsPinchToZoom: this.supportsPinchToZoom,
enableAutoLinking: AppOptions.get("enableAutoLinking"),
Expand All @@ -529,7 +527,7 @@ const PDFViewerApplication = {
renderingQueue: pdfRenderingQueue,
linkService: pdfLinkService,
pageColors,
abortSignal: this._globalAbortController.signal,
abortSignal,
enableHWA,
});
pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
Expand Down Expand Up @@ -574,15 +572,12 @@ const PDFViewerApplication = {
}
}

if (
this.mlManager &&
appConfig.secondaryToolbar?.imageAltTextSettingsButton
) {
if (mlManager && appConfig.secondaryToolbar?.imageAltTextSettingsButton) {
this.imageAltTextSettings = new ImageAltTextSettings(
appConfig.altTextSettingsDialog,
this.overlayManager,
eventBus,
this.mlManager
mlManager
);
}

Expand Down

0 comments on commit 21829f4

Please sign in to comment.