Skip to content

Commit

Permalink
Merge pull request #12563 from Snuffleupagus/rm-SystemJS-worker
Browse files Browse the repository at this point in the history
[api-minor] Remove SystemJS usage, in development mode, from the worker
  • Loading branch information
Snuffleupagus authored May 3, 2023
2 parents ade1e52 + 88616f7 commit f31b320
Show file tree
Hide file tree
Showing 57 changed files with 5,058 additions and 5,532 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"globals": {
"PDFJSDev": false,
"exports": false,
"SystemJS": false,
},

"rules": {
Expand Down
152 changes: 0 additions & 152 deletions external/systemjs/plugin-babel-cached.js

This file was deleted.

26 changes: 0 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
"streamqueue": "^1.1.2",
"stylelint": "^15.6.0",
"stylelint-prettier": "^3.0.0",
"systemjs": "^0.21.6",
"systemjs-plugin-babel": "^0.0.25",
"terser": "^5.17.1",
"through2": "^4.0.2",
"ttest": "^4.0.0",
Expand Down
13 changes: 0 additions & 13 deletions src/core/.eslintrc

This file was deleted.

13 changes: 6 additions & 7 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1556,11 +1556,10 @@ class WidgetAnnotation extends Annotation {

this.setDefaultAppearance(params);

data.hasAppearance =
(this._needAppearances &&
data.fieldValue !== undefined &&
data.fieldValue !== null) ||
data.hasAppearance;
data.hasAppearance ||=
this._needAppearances &&
data.fieldValue !== undefined &&
data.fieldValue !== null;

const fieldType = getInheritableProperty({ dict, key: "FT" });
data.fieldType = fieldType instanceof Name ? fieldType.name : null;
Expand Down Expand Up @@ -1808,7 +1807,7 @@ class WidgetAnnotation extends Annotation {
if (!this._hasValueFromXFA && rotation === undefined) {
return null;
}
value = value || this.data.fieldValue;
value ||= this.data.fieldValue;
}

// Value can be an array (with choice list and multiple selections)
Expand Down Expand Up @@ -3472,7 +3471,7 @@ class LinkAnnotation extends Annotation {
}

// The color entry for a link annotation is the color of the border.
this.data.borderColor = this.data.borderColor || this.data.color;
this.data.borderColor ||= this.data.color;

Catalog.parseDestDictionary({
destDict: params.dict,
Expand Down
6 changes: 1 addition & 5 deletions src/core/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -985,12 +985,8 @@ class Catalog {
} else if (typeof js !== "string") {
return;
}

if (javaScript === null) {
javaScript = new Map();
}
js = stringToPDFString(js).replaceAll("\x00", "");
javaScript.set(name, js);
(javaScript ||= new Map()).set(name, js);
}

if (obj instanceof Dict && obj.has("JavaScript")) {
Expand Down
6 changes: 3 additions & 3 deletions src/core/chunked_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

import { arrayBuffersToBytes, MissingDataException } from "./core_utils.js";
import { assert, createPromiseCapability } from "../shared/util.js";
import { assert, PromiseCapability } from "../shared/util.js";
import { Stream } from "./stream.js";

class ChunkedStream extends Stream {
Expand Down Expand Up @@ -275,7 +275,7 @@ class ChunkedStreamManager {
this.progressiveDataLength = 0;
this.aborted = false;

this._loadedStreamCapability = createPromiseCapability();
this._loadedStreamCapability = new PromiseCapability();
}

sendRequest(begin, end) {
Expand Down Expand Up @@ -349,7 +349,7 @@ class ChunkedStreamManager {
return Promise.resolve();
}

const capability = createPromiseCapability();
const capability = new PromiseCapability();
this._promisesByRequest.set(requestId, capability);

const chunksToRequest = [];
Expand Down
10 changes: 5 additions & 5 deletions src/core/colorspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -1220,9 +1220,9 @@ const CalRGBCS = (function CalRGBCSClosure() {
"WhitePoint missing - required for color space CalRGB"
);
}
blackPoint = blackPoint || new Float32Array(3);
gamma = gamma || new Float32Array([1, 1, 1]);
matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
blackPoint ||= new Float32Array(3);
gamma ||= new Float32Array([1, 1, 1]);
matrix ||= new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);

// Translate arguments to spec variables.
const XW = whitePoint[0];
Expand Down Expand Up @@ -1396,8 +1396,8 @@ const LabCS = (function LabCSClosure() {
"WhitePoint missing - required for color space Lab"
);
}
blackPoint = blackPoint || [0, 0, 0];
range = range || [-100, 100, -100, 100];
blackPoint ||= [0, 0, 0];
range ||= [-100, 100, -100, 100];

// Translate args to spec variables
this.XW = whitePoint[0];
Expand Down
24 changes: 2 additions & 22 deletions src/core/core_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,6 @@ function getLookupTableFactory(initializer) {
};
}

function getArrayLookupTableFactory(initializer) {
let lookup;
return function () {
if (initializer) {
let arr = initializer();
initializer = null;
lookup = Object.create(null);
for (let i = 0, ii = arr.length; i < ii; i += 2) {
lookup[arr[i]] = arr[i + 1];
}
arr = null;
}
return lookup;
};
}

class MissingDataException extends BaseException {
constructor(begin, end) {
super(`Missing data [${begin}, ${end})`, "MissingDataException");
Expand Down Expand Up @@ -153,10 +137,7 @@ function getInheritableProperty({
if (stopWhenFound) {
return value;
}
if (!values) {
values = [];
}
values.push(value);
(values ||= []).push(value);
}
dict = dict.get("Parent");
}
Expand Down Expand Up @@ -338,7 +319,7 @@ function _collectJS(entry, xref, list, parents) {
} else if (typeof js === "string") {
code = js;
}
code = code && stringToPDFString(code).replaceAll("\x00", "");
code &&= stringToPDFString(code).replaceAll("\x00", "");
if (code) {
list.push(code);
}
Expand Down Expand Up @@ -616,7 +597,6 @@ export {
encodeToXmlString,
escapePDFName,
escapeString,
getArrayLookupTableFactory,
getInheritableProperty,
getLookupTableFactory,
getNewAnnotationsMap,
Expand Down
Loading

0 comments on commit f31b320

Please sign in to comment.