1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Merge pull request #19681 from Snuffleupagus/AbortSignal-any-basic-polyfill

[api-minor] Add a basic `AbortSignal.any` polyfill in PDF.js `legacy` builds
This commit is contained in:
Tim van der Meij 2025-03-22 13:20:18 +01:00 committed by GitHub
commit 9023395550
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 30 deletions

View file

@ -559,11 +559,7 @@ const PDFViewerApplication = {
}
if (appConfig.annotationEditorParams) {
if (
((typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
typeof AbortSignal.any === "function") &&
annotationEditorMode !== AnnotationEditorType.DISABLE
) {
if (annotationEditorMode !== AnnotationEditorType.DISABLE) {
const editorSignatureButton = appConfig.toolbar?.editorSignatureButton;
if (editorSignatureButton && AppOptions.get("enableSignatureEditor")) {
editorSignatureButton.parentElement.hidden = false;
@ -2075,19 +2071,14 @@ const PDFViewerApplication = {
_windowAbortController: { signal },
} = this;
if (
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
typeof AbortSignal.any === "function"
) {
this._touchManager = new TouchManager({
container: window,
isPinchingDisabled: () => pdfViewer.isInPresentationMode,
isPinchingStopped: () => this.overlayManager?.active,
onPinching: this.touchPinchCallback.bind(this),
onPinchEnd: this.touchPinchEndCallback.bind(this),
signal,
});
}
this._touchManager = new TouchManager({
container: window,
isPinchingDisabled: () => pdfViewer.isInPresentationMode,
isPinchingStopped: () => this.overlayManager?.active,
onPinching: this.touchPinchCallback.bind(this),
onPinchEnd: this.touchPinchEndCallback.bind(this),
signal,
});
function addWindowResolutionChange(evt = null) {
if (evt) {

View file

@ -711,13 +711,7 @@ class PDFViewer {
hiddenCapability.resolve();
}
},
{
signal:
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
typeof AbortSignal.any === "function"
? AbortSignal.any([signal, ac.signal])
: signal,
}
{ signal: AbortSignal.any([signal, ac.signal]) }
);
await Promise.race([
@ -914,11 +908,7 @@ class PDFViewer {
viewer.before(element);
}
if (
((typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
typeof AbortSignal.any === "function") &&
annotationEditorMode !== AnnotationEditorType.DISABLE
) {
if (annotationEditorMode !== AnnotationEditorType.DISABLE) {
const mode = annotationEditorMode;
if (pdfDocument.isPureXfa) {