Skip to content

Commit fb902c1

Browse files
committed
Correctly generate the NormalizeWithNFKC string in generic build
It fixes #20689.
1 parent ad0a310 commit fb902c1

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

web/pdf_find_utils.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,21 @@ function getNormalizeWithNFKC() {
120120
(typeof PDFJSDev === "undefined" && FeatureTest.platform.isFirefox) ||
121121
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL"))
122122
) {
123+
// The `NormalizeWithNFKC` string is generated with the for loop below.
124+
// Because of a small difference between Chrome and Firefox, the string is
125+
// only hardcoded for Firefox, and Chrome (or others) will generate it at
126+
// runtime.
127+
// In order to detect if the string is up to date, a check is performed in
128+
// the loop below, and if a difference is detected, an error is thrown.
123129
/* eslint-disable no-irregular-whitespace */
124130
NormalizeWithNFKC ||= `\xA0¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰ꟱-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;
125131
}
126132

127-
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
133+
if (
134+
typeof PDFJSDev === "undefined" ||
135+
PDFJSDev.test("TESTING") ||
136+
(!PDFJSDev.test("MOZCENTRAL") && !NormalizeWithNFKC)
137+
) {
128138
const ranges = [];
129139
const range = [];
130140
const diacriticsRegex = /^\p{M}$/u;

0 commit comments

Comments
 (0)