diff --git a/toolkit/components/pdfjs/content/build/pdf.js b/toolkit/components/pdfjs/content/build/pdf.js --- a/toolkit/components/pdfjs/content/build/pdf.js +++ b/toolkit/components/pdfjs/content/build/pdf.js @@ -916,11 +916,11 @@ task._worker = worker; } const docId = task.docId; const fetchDocParams = { docId, - apiVersion: '3.4.97', + apiVersion: '3.4.103', data, password, disableAutoFetch, rangeChunkSize, length, @@ -2584,13 +2584,13 @@ this.callback(); } } } } -const version = '3.4.97'; +const version = '3.4.103'; exports.version = version; -const build = '22618213c'; +const build = '13af3f344'; exports.build = build; /***/ }), /* 3 */ /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { @@ -2661,10 +2661,15 @@ return this.#storage.has(key); } getAll() { return this.#storage.size > 0 ? (0, _util.objectFromMap)(this.#storage) : null; } + setAll(obj) { + for (const [key, val] of Object.entries(obj)) { + this.setValue(key, val); + } + } get size() { return this.#storage.size; } #setModified() { if (!this.#modified) { @@ -12999,13 +13004,13 @@ var _tools = __w_pdfjs_require__(5); var _annotation_layer = __w_pdfjs_require__(26); var _worker_options = __w_pdfjs_require__(14); var _svg = __w_pdfjs_require__(29); var _xfa_layer = __w_pdfjs_require__(28); -const pdfjsVersion = '3.4.97'; -const pdfjsBuild = '22618213c'; +const pdfjsVersion = '3.4.103'; +const pdfjsBuild = '13af3f344'; })(); /******/ return __webpack_exports__; /******/ })() ; }); \ No newline at end of file diff --git a/toolkit/components/pdfjs/content/build/pdf.scripting.js b/toolkit/components/pdfjs/content/build/pdf.scripting.js --- a/toolkit/components/pdfjs/content/build/pdf.scripting.js +++ b/toolkit/components/pdfjs/content/build/pdf.scripting.js @@ -4256,13 +4256,13 @@ get: function () { return _initialization.initSandbox; } })); var _initialization = __w_pdfjs_require__(1); -const pdfjsVersion = '3.4.97'; -const pdfjsBuild = '22618213c'; +const pdfjsVersion = '3.4.103'; +const pdfjsBuild = '13af3f344'; })(); /******/ return __webpack_exports__; /******/ })() ; }); \ No newline at end of file diff --git a/toolkit/components/pdfjs/content/build/pdf.worker.js b/toolkit/components/pdfjs/content/build/pdf.worker.js --- a/toolkit/components/pdfjs/content/build/pdf.worker.js +++ b/toolkit/components/pdfjs/content/build/pdf.worker.js @@ -99,11 +99,11 @@ const verbosity = (0, _util.getVerbosityLevel)(); const { docId, apiVersion } = docParams; - const workerVersion = '3.4.97'; + const workerVersion = '3.4.103'; if (apiVersion !== workerVersion) { throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); } const workerHandlerName = docId + "_worker"; let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port); @@ -52452,13 +52452,13 @@ get: function () { return _worker.WorkerMessageHandler; } })); var _worker = __w_pdfjs_require__(1); -const pdfjsVersion = '3.4.97'; -const pdfjsBuild = '22618213c'; +const pdfjsVersion = '3.4.103'; +const pdfjsBuild = '13af3f344'; })(); /******/ return __webpack_exports__; /******/ })() ; }); \ No newline at end of file diff --git a/toolkit/components/pdfjs/content/web/viewer-geckoview.js b/toolkit/components/pdfjs/content/web/viewer-geckoview.js --- a/toolkit/components/pdfjs/content/web/viewer-geckoview.js +++ b/toolkit/components/pdfjs/content/web/viewer-geckoview.js @@ -808,11 +808,10 @@ pdfLinkService.setViewer(this.pdfViewer); pdfScriptingManager.setViewer(this.pdfViewer); if (appConfig.sidebar?.thumbnailView) { this.pdfThumbnailViewer = new _webPdf_thumbnail_viewer.PDFThumbnailViewer({ container: appConfig.sidebar.thumbnailView, - eventBus, renderingQueue: pdfRenderingQueue, linkService: pdfLinkService, l10n: this.l10n, pageColors }); @@ -4248,11 +4247,12 @@ normalizationRegex = withSyllablesRegExp; } else { const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(""); const toNormalizeWithNFKC = "\u2460-\u2473" + "\u24b6-\u24ff" + "\u3244-\u32bf" + "\u32d0-\u32fe" + "\uff00-\uffef"; const CJK = "(?:\\p{Ideographic}|[\u3040-\u30FF])"; - const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${CJK}\\n)|(\\n)`; + const HKDiacritics = "(?:\u3099|\u309A)"; + const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${CJK}\\n)|(\\n)`; if (syllablePositions.length === 0) { normalizationRegex = noSyllablesRegExp = new RegExp(regexp + "|(\\u0000)", "gum"); } else { normalizationRegex = withSyllablesRegExp = new RegExp(regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`, "gum"); } @@ -4267,11 +4267,11 @@ let syllableIndex = 0; let shift = 0; let shiftOrigin = 0; let eol = 0; let hasDiacritics = false; - normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, i) => { + normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, p8, i) => { i -= shiftOrigin; if (p1) { const replacement = CHARACTERS_TO_NORMALIZE[p1]; const jj = replacement.length; for (let j = 1; j < jj; j++) { @@ -4292,12 +4292,26 @@ } shift -= jj - 1; return replacement; } if (p3) { - const hasTrailingDashEOL = p3.endsWith("\n"); - const len = hasTrailingDashEOL ? p3.length - 2 : p3.length; + hasDiacritics = true; + if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { + ++rawDiacriticsIndex; + } else { + positions.push([i - 1 - shift + 1, shift - 1]); + shift -= 1; + shiftOrigin += 1; + } + positions.push([i - shift + 1, shift]); + shiftOrigin += 1; + eol += 1; + return p3.charAt(0); + } + if (p4) { + const hasTrailingDashEOL = p4.endsWith("\n"); + const len = hasTrailingDashEOL ? p4.length - 2 : p4.length; hasDiacritics = true; let jj = len; if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { jj -= rawDiacriticsPositions[rawDiacriticsIndex][0]; ++rawDiacriticsIndex; @@ -4311,28 +4325,28 @@ i += len - 1; positions.push([i - shift + 1, 1 + shift]); shift += 1; shiftOrigin += 1; eol += 1; - return p3.slice(0, len); - } - return p3; - } - if (p4) { + return p4.slice(0, len); + } + return p4; + } + if (p5) { positions.push([i - shift + 1, 1 + shift]); shift += 1; shiftOrigin += 1; eol += 1; - return p4.charAt(0); - } - if (p5) { - positions.push([i - shift + 1, shift]); - shiftOrigin += 1; - eol += 1; return p5.charAt(0); } if (p6) { + positions.push([i - shift + 1, shift]); + shiftOrigin += 1; + eol += 1; + return p6.charAt(0); + } + if (p7) { positions.push([i - shift + 1, shift - 1]); shift -= 1; shiftOrigin += 1; eol += 1; return " "; @@ -4344,11 +4358,11 @@ positions.push([i - (shift - j), shift - j]); } shift -= newCharLen; shiftOrigin += newCharLen; } - return p7; + return p8; }); positions.push([normalized.length, shift]); return [normalized, positions, hasDiacritics]; } function getOriginalIndex(diffs, pos, len) { @@ -6004,11 +6018,11 @@ #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this)); #scrollModePageState = null; #onVisibilityChange = null; #scaleTimeoutId = null; constructor(options) { - const viewerVersion = '3.4.97'; + const viewerVersion = '3.4.103'; if (_pdfjsLib.version !== viewerVersion) { throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`); } this.container = options.container; this.viewer = options.viewer || options.container.firstElementChild; @@ -9413,12 +9427,12 @@ __webpack_require__(1); var _ui_utils = __webpack_require__(4); var _app_options = __webpack_require__(6); var _pdf_link_service = __webpack_require__(8); var _app = __webpack_require__(3); -const pdfjsVersion = '3.4.97'; -const pdfjsBuild = '22618213c'; +const pdfjsVersion = '3.4.103'; +const pdfjsBuild = '13af3f344'; const AppConstants = null; exports.PDFViewerApplicationConstants = AppConstants; window.PDFViewerApplication = _app.PDFViewerApplication; window.PDFViewerApplicationConstants = AppConstants; window.PDFViewerApplicationOptions = _app_options.AppOptions; diff --git a/toolkit/components/pdfjs/content/web/viewer.js b/toolkit/components/pdfjs/content/web/viewer.js --- a/toolkit/components/pdfjs/content/web/viewer.js +++ b/toolkit/components/pdfjs/content/web/viewer.js @@ -808,11 +808,10 @@ pdfLinkService.setViewer(this.pdfViewer); pdfScriptingManager.setViewer(this.pdfViewer); if (appConfig.sidebar?.thumbnailView) { this.pdfThumbnailViewer = new _webPdf_thumbnail_viewer.PDFThumbnailViewer({ container: appConfig.sidebar.thumbnailView, - eventBus, renderingQueue: pdfRenderingQueue, linkService: pdfLinkService, l10n: this.l10n, pageColors }); @@ -5181,11 +5180,12 @@ normalizationRegex = withSyllablesRegExp; } else { const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(""); const toNormalizeWithNFKC = "\u2460-\u2473" + "\u24b6-\u24ff" + "\u3244-\u32bf" + "\u32d0-\u32fe" + "\uff00-\uffef"; const CJK = "(?:\\p{Ideographic}|[\u3040-\u30FF])"; - const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${CJK}\\n)|(\\n)`; + const HKDiacritics = "(?:\u3099|\u309A)"; + const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${CJK}\\n)|(\\n)`; if (syllablePositions.length === 0) { normalizationRegex = noSyllablesRegExp = new RegExp(regexp + "|(\\u0000)", "gum"); } else { normalizationRegex = withSyllablesRegExp = new RegExp(regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`, "gum"); } @@ -5200,11 +5200,11 @@ let syllableIndex = 0; let shift = 0; let shiftOrigin = 0; let eol = 0; let hasDiacritics = false; - normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, i) => { + normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, p8, i) => { i -= shiftOrigin; if (p1) { const replacement = CHARACTERS_TO_NORMALIZE[p1]; const jj = replacement.length; for (let j = 1; j < jj; j++) { @@ -5225,12 +5225,26 @@ } shift -= jj - 1; return replacement; } if (p3) { - const hasTrailingDashEOL = p3.endsWith("\n"); - const len = hasTrailingDashEOL ? p3.length - 2 : p3.length; + hasDiacritics = true; + if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { + ++rawDiacriticsIndex; + } else { + positions.push([i - 1 - shift + 1, shift - 1]); + shift -= 1; + shiftOrigin += 1; + } + positions.push([i - shift + 1, shift]); + shiftOrigin += 1; + eol += 1; + return p3.charAt(0); + } + if (p4) { + const hasTrailingDashEOL = p4.endsWith("\n"); + const len = hasTrailingDashEOL ? p4.length - 2 : p4.length; hasDiacritics = true; let jj = len; if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { jj -= rawDiacriticsPositions[rawDiacriticsIndex][0]; ++rawDiacriticsIndex; @@ -5244,28 +5258,28 @@ i += len - 1; positions.push([i - shift + 1, 1 + shift]); shift += 1; shiftOrigin += 1; eol += 1; - return p3.slice(0, len); - } - return p3; - } - if (p4) { + return p4.slice(0, len); + } + return p4; + } + if (p5) { positions.push([i - shift + 1, 1 + shift]); shift += 1; shiftOrigin += 1; eol += 1; - return p4.charAt(0); - } - if (p5) { - positions.push([i - shift + 1, shift]); - shiftOrigin += 1; - eol += 1; return p5.charAt(0); } if (p6) { + positions.push([i - shift + 1, shift]); + shiftOrigin += 1; + eol += 1; + return p6.charAt(0); + } + if (p7) { positions.push([i - shift + 1, shift - 1]); shift -= 1; shiftOrigin += 1; eol += 1; return " "; @@ -5277,11 +5291,11 @@ positions.push([i - (shift - j), shift - j]); } shift -= newCharLen; shiftOrigin += newCharLen; } - return p7; + return p8; }); positions.push([normalized.length, shift]); return [normalized, positions, hasDiacritics]; } function getOriginalIndex(diffs, pos, len) { @@ -8001,11 +8015,10 @@ const THUMBNAIL_SCROLL_MARGIN = -19; const THUMBNAIL_SELECTED_CLASS = "selected"; class PDFThumbnailViewer { constructor({ container, - eventBus, linkService, renderingQueue, l10n, pageColors }) { @@ -8615,11 +8628,11 @@ #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this)); #scrollModePageState = null; #onVisibilityChange = null; #scaleTimeoutId = null; constructor(options) { - const viewerVersion = '3.4.97'; + const viewerVersion = '3.4.103'; if (_pdfjsLib.version !== viewerVersion) { throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`); } this.container = options.container; this.viewer = options.viewer || options.container.firstElementChild; @@ -12765,12 +12778,12 @@ __webpack_require__(44); var _ui_utils = __webpack_require__(4); var _app_options = __webpack_require__(6); var _pdf_link_service = __webpack_require__(8); var _app = __webpack_require__(3); -const pdfjsVersion = '3.4.97'; -const pdfjsBuild = '22618213c'; +const pdfjsVersion = '3.4.103'; +const pdfjsBuild = '13af3f344'; const AppConstants = null; exports.PDFViewerApplicationConstants = AppConstants; window.PDFViewerApplication = _app.PDFViewerApplication; window.PDFViewerApplicationConstants = AppConstants; window.PDFViewerApplicationOptions = _app_options.AppOptions; diff --git a/toolkit/components/pdfjs/moz.yaml b/toolkit/components/pdfjs/moz.yaml --- a/toolkit/components/pdfjs/moz.yaml +++ b/toolkit/components/pdfjs/moz.yaml @@ -18,12 +18,12 @@ # Usually different from repository url url: https://github.com/mozilla/pdf.js # Human-readable identifier for this version/release # Generally "version NNN", "tag SSS", "bookmark SSS" - release: 22618213c7f69060d5e7c4823f3f9863588236df (2023-02-12T10:47:57Z). - revision: 22618213c7f69060d5e7c4823f3f9863588236df + release: 13af3f3442d1e6c0b08c39a54605f6bd5b564b1c (2023-02-17T12:40:54Z). + revision: 13af3f3442d1e6c0b08c39a54605f6bd5b564b1c # The package's license, where possible using the mnemonic from # https://spdx.org/licenses/ # Multiple licenses can be specified (as a YAML list) # A "LICENSE" file must exist containing the full license text