mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Move the escapeString
helper function into the worker-thread
Given that this helper function is only used on the worker-thread, there's no reason to duplicate it in both of the `pdf.js` and `pdf.worker.js` files.
This commit is contained in:
parent
e5859e145d
commit
9adc7859c8
6 changed files with 31 additions and 27 deletions
|
@ -17,6 +17,7 @@ import { Dict, Ref } from "../../src/core/primitives.js";
|
|||
import {
|
||||
encodeToXmlString,
|
||||
escapePDFName,
|
||||
escapeString,
|
||||
getInheritableProperty,
|
||||
isAscii,
|
||||
isWhiteSpace,
|
||||
|
@ -223,6 +224,14 @@ describe("core_utils", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("escapeString", function () {
|
||||
it("should escape (, ), \\n, \\r, and \\", function () {
|
||||
expect(escapeString("((a\\a))\n(b(b\\b)\rb)")).toEqual(
|
||||
"\\(\\(a\\\\a\\)\\)\\n\\(b\\(b\\\\b\\)\\rb\\)"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("encodeToXmlString", function () {
|
||||
it("should get a correctly encoded string with some entities", function () {
|
||||
const str = "\"\u0397ell😂' & <W😂rld>";
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
bytesToString,
|
||||
createPromiseCapability,
|
||||
createValidAbsoluteUrl,
|
||||
escapeString,
|
||||
getModificationDate,
|
||||
isArrayBuffer,
|
||||
string32,
|
||||
|
@ -244,14 +243,6 @@ describe("util", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("escapeString", function () {
|
||||
it("should escape (, ), \\n, \\r, and \\", function () {
|
||||
expect(escapeString("((a\\a))\n(b(b\\b)\rb)")).toEqual(
|
||||
"\\(\\(a\\\\a\\)\\)\\n\\(b\\(b\\\\b\\)\\rb\\)"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getModificationDate", function () {
|
||||
it("should get a correctly formatted date", function () {
|
||||
const date = new Date(Date.UTC(3141, 5, 9, 2, 6, 53));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue