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