mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-24 16:07:22 +02:00
Compare commits
8 Commits
b070a502c3
...
d97b65378f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d97b65378f | ||
|
|
f4a3e47018 | ||
|
|
f01b13d332 | ||
|
|
b3ccc55c1d | ||
|
|
be463f0e0c | ||
|
|
e5e9d18289 | ||
|
|
8129ccc9a7 | ||
|
|
64c1e07f22 |
12
gulpfile.mjs
12
gulpfile.mjs
@ -491,7 +491,8 @@ function checkChromePreferencesFile(chromePrefsPath, webPrefs) {
|
||||
|
||||
function createMainBundle(defines) {
|
||||
const mainFileConfig = createWebpackConfig(defines, {
|
||||
filename: defines.MINIFIED ? "pdf.min.mjs" : "pdf.mjs",
|
||||
filename:
|
||||
defines.MINIFIED && !defines.MOZCENTRAL ? "pdf.min.mjs" : "pdf.mjs",
|
||||
library: {
|
||||
type: "module",
|
||||
},
|
||||
@ -571,7 +572,10 @@ function createSandboxBundle(defines, extraOptions = undefined) {
|
||||
|
||||
function createWorkerBundle(defines) {
|
||||
const workerFileConfig = createWebpackConfig(defines, {
|
||||
filename: defines.MINIFIED ? "pdf.worker.min.mjs" : "pdf.worker.mjs",
|
||||
filename:
|
||||
defines.MINIFIED && !defines.MOZCENTRAL
|
||||
? "pdf.worker.min.mjs"
|
||||
: "pdf.worker.mjs",
|
||||
library: {
|
||||
type: "module",
|
||||
},
|
||||
@ -1388,7 +1392,7 @@ gulp.task(
|
||||
gulp.series(
|
||||
createBuildNumber,
|
||||
function scriptingMozcentral() {
|
||||
const defines = { ...DEFINES, MOZCENTRAL: true };
|
||||
const defines = { ...DEFINES, MOZCENTRAL: true, MINIFIED: true };
|
||||
return buildDefaultPreferences(defines, "mozcentral/");
|
||||
},
|
||||
async function prefsMozcentral() {
|
||||
@ -1397,7 +1401,7 @@ gulp.task(
|
||||
function createMozcentral() {
|
||||
console.log();
|
||||
console.log("### Building mozilla-central extension");
|
||||
const defines = { ...DEFINES, MOZCENTRAL: true };
|
||||
const defines = { ...DEFINES, MOZCENTRAL: true, MINIFIED: true };
|
||||
const gvDefines = { ...defines, GECKOVIEW: true };
|
||||
|
||||
const MOZCENTRAL_DIR = BUILD_DIR + "mozcentral/",
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@ -12099,9 +12099,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "6.21.1",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz",
|
||||
"integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==",
|
||||
"version": "6.21.3",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.21.3.tgz",
|
||||
"integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
@ -688,20 +688,16 @@ class PDFDocumentLoadingTask {
|
||||
async destroy() {
|
||||
this.destroyed = true;
|
||||
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
await this._transport?.destroy();
|
||||
} else {
|
||||
try {
|
||||
if (this._worker?.port) {
|
||||
this._worker._pendingDestroy = true;
|
||||
}
|
||||
await this._transport?.destroy();
|
||||
} catch (ex) {
|
||||
if (this._worker?.port) {
|
||||
delete this._worker._pendingDestroy;
|
||||
}
|
||||
throw ex;
|
||||
try {
|
||||
if (this._worker?.port) {
|
||||
this._worker._pendingDestroy = true;
|
||||
}
|
||||
await this._transport?.destroy();
|
||||
} catch (ex) {
|
||||
if (this._worker?.port) {
|
||||
delete this._worker._pendingDestroy;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
this._transport = null;
|
||||
|
||||
@ -2101,7 +2097,7 @@ class PDFWorker {
|
||||
|
||||
static #isWorkerDisabled = false;
|
||||
|
||||
static #workerPorts;
|
||||
static #workerPorts = new WeakMap();
|
||||
|
||||
static {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||
@ -2159,14 +2155,11 @@ class PDFWorker {
|
||||
this._webWorker = null;
|
||||
this._messageHandler = null;
|
||||
|
||||
if (
|
||||
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) &&
|
||||
port
|
||||
) {
|
||||
if (PDFWorker.#workerPorts?.has(port)) {
|
||||
if (port) {
|
||||
if (PDFWorker.#workerPorts.has(port)) {
|
||||
throw new Error("Cannot use more than one PDFWorker per port.");
|
||||
}
|
||||
(PDFWorker.#workerPorts ||= new WeakMap()).set(port, this);
|
||||
PDFWorker.#workerPorts.set(port, this);
|
||||
this._initializeFromPort(port);
|
||||
return;
|
||||
}
|
||||
@ -2206,9 +2199,6 @@ class PDFWorker {
|
||||
}
|
||||
|
||||
_initializeFromPort(port) {
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
throw new Error("Not implemented: _initializeFromPort");
|
||||
}
|
||||
this._port = port;
|
||||
this._messageHandler = new MessageHandler("main", "worker", port);
|
||||
this._messageHandler.on("ready", function () {
|
||||
@ -2363,7 +2353,7 @@ class PDFWorker {
|
||||
this._webWorker?.terminate();
|
||||
this._webWorker = null;
|
||||
|
||||
PDFWorker.#workerPorts?.delete(this._port);
|
||||
PDFWorker.#workerPorts.delete(this._port);
|
||||
this._port = null;
|
||||
|
||||
this._messageHandler?.destroy();
|
||||
@ -2375,13 +2365,10 @@ class PDFWorker {
|
||||
* @returns {PDFWorker}
|
||||
*/
|
||||
static fromPort(params) {
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
throw new Error("Not implemented: fromPort");
|
||||
}
|
||||
if (!params?.port) {
|
||||
throw new Error("PDFWorker.fromPort - invalid method signature.");
|
||||
}
|
||||
const cachedPort = this.#workerPorts?.get(params.port);
|
||||
const cachedPort = this.#workerPorts.get(params.port);
|
||||
if (cachedPort) {
|
||||
if (cachedPort._pendingDestroy) {
|
||||
throw new Error(
|
||||
|
||||
@ -502,7 +502,10 @@ const defaultOptions = {
|
||||
|
||||
workerPort: {
|
||||
/** @type {Object} */
|
||||
value: null,
|
||||
value:
|
||||
typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")
|
||||
? globalThis.pdfjsPreloadedWorker
|
||||
: null,
|
||||
kind: OptionKind.WORKER,
|
||||
},
|
||||
workerSrc: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user