Skip to content

Commit a54dfb0

Browse files
updatebot-cicalixteman
authored andcommitted
Bug 2043859 - Update PDF.js to 145feeaa3f66b238566dc2c64477f0c58dc1643a r=calixte
Differential Revision: https://phabricator.services.mozilla.com/D303617
1 parent a5789d9 commit a54dfb0

8 files changed

Lines changed: 1174 additions & 644 deletions

File tree

toolkit/components/pdfjs/PdfJsDefaultPrefs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ pref("pdfjs.imagesRightClickMinSize", 16);
5959
pref("pdfjs.pageColorsBackground", "Canvas");
6060
pref("pdfjs.pageColorsForeground", "CanvasText");
6161
pref("pdfjs.pdfBugEnabled", false);
62+
pref("pdfjs.postMessageAfterPrintCallback", false);
6263
pref("pdfjs.scrollModeOnLoad", -1);
6364
pref("pdfjs.sidebarViewOnLoad", -1);
6465
pref("pdfjs.spreadModeOnLoad", -1);

toolkit/components/pdfjs/content/build/pdf.mjs

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222

2323
/**
24-
* pdfjsVersion = 6.0.213
25-
* pdfjsBuild = 389853d47
24+
* pdfjsVersion = 6.0.229
25+
* pdfjsBuild = 145feeaa3
2626
*/
2727

2828
;// ./src/shared/util.js
@@ -1996,10 +1996,17 @@ class FloatingToolbar {
19961996
}
19971997
}
19981998

1999+
;// ./src/shared/internal_evt.js
2000+
const INTERNAL_EVT = "1684dd60-3936-4889-b86a-7f7f4e3a1938";
2001+
const internalOpt = Object.freeze({
2002+
internal: INTERNAL_EVT
2003+
});
2004+
19992005
;// ./src/display/editor/tools.js
20002006

20012007

20022008

2009+
20032010
function bindEvents(obj, element, names) {
20042011
for (const name of names) {
20052012
element.addEventListener(name, obj[name].bind(obj));
@@ -2558,24 +2565,16 @@ class AnnotationEditorUIManager {
25582565
this.#signatureManager = signatureManager;
25592566
this.#pdfDocument = pdfDocument;
25602567
this._eventBus = eventBus;
2561-
eventBus._on("editingaction", this.onEditingAction.bind(this), {
2562-
signal
2563-
});
2564-
eventBus._on("pagechanging", this.onPageChanging.bind(this), {
2565-
signal
2566-
});
2567-
eventBus._on("scalechanging", this.onScaleChanging.bind(this), {
2568-
signal
2569-
});
2570-
eventBus._on("rotationchanging", this.onRotationChanging.bind(this), {
2571-
signal
2572-
});
2573-
eventBus._on("setpreference", this.onSetPreference.bind(this), {
2574-
signal
2575-
});
2576-
eventBus._on("switchannotationeditorparams", evt => this.updateParams(evt.type, evt.value), {
2577-
signal
2578-
});
2568+
const evtOpts = {
2569+
signal,
2570+
...internalOpt
2571+
};
2572+
eventBus.on("editingaction", this.onEditingAction.bind(this), evtOpts);
2573+
eventBus.on("pagechanging", this.onPageChanging.bind(this), evtOpts);
2574+
eventBus.on("scalechanging", this.onScaleChanging.bind(this), evtOpts);
2575+
eventBus.on("rotationchanging", this.onRotationChanging.bind(this), evtOpts);
2576+
eventBus.on("setpreference", this.onSetPreference.bind(this), evtOpts);
2577+
eventBus.on("switchannotationeditorparams", evt => this.updateParams(evt.type, evt.value), evtOpts);
25792578
window.addEventListener("pointerdown", () => {
25802579
this.#isPointerDown = true;
25812580
}, {
@@ -2775,7 +2774,7 @@ class AnnotationEditorUIManager {
27752774
} = Promise.withResolvers();
27762775
const onEditorsRendered = evt => {
27772776
if (evt.pageNumber === pageNumber) {
2778-
this._eventBus._off("editorsrendered", onEditorsRendered);
2777+
this._eventBus.off("editorsrendered", onEditorsRendered);
27792778
resolve();
27802779
}
27812780
};
@@ -14121,7 +14120,7 @@ function getDocument(src = {}) {
1412114120
}
1412214121
const docParams = {
1412314122
docId,
14124-
apiVersion: "6.0.213",
14123+
apiVersion: "6.0.229",
1412514124
data,
1412614125
password,
1412714126
disableAutoFetch,
@@ -15373,12 +15372,27 @@ class WorkerTransport {
1537315372
pageInfos
1537415373
};
1537515374
let transfer;
15375+
const ImageBitmapCtor = globalThis.ImageBitmap;
15376+
if (typeof ImageBitmapCtor === "function") {
15377+
const infos = Array.isArray(pageInfos) ? pageInfos : [pageInfos];
15378+
for (const pageInfo of infos) {
15379+
if (pageInfo?.image instanceof ImageBitmapCtor) {
15380+
(transfer ||= []).push(pageInfo.image);
15381+
}
15382+
}
15383+
}
1537615384
if (this.annotationStorage.size > 0) {
1537715385
const serialized = this.annotationStorage.serializable;
1537815386
let {
1537915387
map
1538015388
} = serialized;
15381-
transfer = serialized.transfer;
15389+
if (serialized.transfer?.length) {
15390+
if (transfer) {
15391+
transfer.push(...serialized.transfer);
15392+
} else {
15393+
transfer = serialized.transfer;
15394+
}
15395+
}
1538215396
const mapping = this.pagesMapper.getMapping();
1538315397
if (mapping) {
1538415398
const remapped = new Map();
@@ -15749,8 +15763,8 @@ class InternalRenderTask {
1574915763
}
1575015764
}
1575115765
}
15752-
const version = "6.0.213";
15753-
const build = "389853d47";
15766+
const version = "6.0.229";
15767+
const build = "145feeaa3";
1575415768

1575515769
;// ./src/display/editor/color_picker.js
1575615770

toolkit/components/pdfjs/content/build/pdf.scripting.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222

2323
/**
24-
* pdfjsVersion = 6.0.213
25-
* pdfjsBuild = 389853d47
24+
* pdfjsVersion = 6.0.229
25+
* pdfjsBuild = 145feeaa3
2626
*/
2727

2828
;// ./src/scripting_api/constants.js

0 commit comments

Comments
 (0)