Backed out changeset e38f6abaf757 (bug 1895324) for causing pdfpaint failures. CLOSED TREE

This commit is contained in:
Cristina Horotan 2024-05-07 04:40:58 +03:00
Родитель b69f8e73b1
Коммит 522d21799a
7 изменённых файлов: 69 добавлений и 51 удалений

Просмотреть файл

@ -674,4 +674,4 @@ mozilla-pdf.js:
fetch:
type: git
repo: https://github.com/mozilla/pdf.js
revision: 14e87469dbb04fa0e9e6f7ec23e5c9d7b283e901
revision: d64f334f98d4b7f1c2e09a731a63b68629c946f9

Просмотреть файл

@ -1448,8 +1448,10 @@ function isDataScheme(url) {
function isPdfFile(filename) {
return typeof filename === "string" && /\.pdf$/i.test(filename);
}
function getFilenameFromUrl(url) {
[url] = url.split(/[#?]/, 1);
function getFilenameFromUrl(url, onlyStripPath = false) {
if (!onlyStripPath) {
[url] = url.split(/[#?]/, 1);
}
return url.substring(url.lastIndexOf("/") + 1);
}
function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") {
@ -9351,7 +9353,7 @@ function getDocument(src) {
}
const fetchDocParams = {
docId,
apiVersion: "4.3.18",
apiVersion: "4.3.8",
data,
password,
disableAutoFetch,
@ -11011,8 +11013,8 @@ class InternalRenderTask {
}
}
}
const version = "4.3.18";
const build = "14e87469d";
const version = "4.3.8";
const build = "c419c8333";
;// CONCATENATED MODULE: ./src/shared/scripting_utils.js
function makeColorComp(n) {
@ -13549,13 +13551,17 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
isRenderable: true
});
const {
file
} = this.data;
this.filename = file.filename;
this.content = file.content;
filename,
content,
description
} = this.data.file;
this.filename = getFilenameFromUrl(filename, true);
this.content = content;
this.linkService.eventBus?.dispatch("fileattachmentannotation", {
source: this,
...file
filename,
content,
description
});
}
render() {
@ -17798,8 +17804,8 @@ class DrawLayer {
const pdfjsVersion = "4.3.18";
const pdfjsBuild = "14e87469d";
const pdfjsVersion = "4.3.8";
const pdfjsBuild = "c419c8333";
var __webpack_exports__AbortException = __webpack_exports__.AbortException;
var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;

Просмотреть файл

@ -3956,8 +3956,8 @@ function initSandbox(params) {
;// CONCATENATED MODULE: ./src/pdf.scripting.js
const pdfjsVersion = "4.3.18";
const pdfjsBuild = "14e87469d";
const pdfjsVersion = "4.3.8";
const pdfjsBuild = "c419c8333";
globalThis.pdfjsScripting = {
initSandbox: initSandbox
};

Просмотреть файл

@ -7508,7 +7508,7 @@ class JpegStream extends DecodeStream {
;// CONCATENATED MODULE: ./external/openjpeg/openjpeg.js
var OpenJPEG = (() => {
var _scriptDir = "file:///builds/worker/pdf.js/external/openjpeg/openjpeg.js";
var _scriptDir = "file:///home/calixte/dev/mozilla/pdf.js.release/external/openjpeg/openjpeg.js";
return function (moduleArg = {}) {
var Module = moduleArg;
var readyPromiseResolve, readyPromiseReject;
@ -33978,9 +33978,6 @@ function clearGlobalCaches() {
function pickPlatformItem(dict) {
if (!(dict instanceof Dict)) {
return null;
}
if (dict.has("UF")) {
return dict.get("UF");
} else if (dict.has("F")) {
@ -33994,9 +33991,6 @@ function pickPlatformItem(dict) {
}
return null;
}
function stripPath(str) {
return str.substring(str.lastIndexOf("/") + 1);
}
class FileSpec {
#contentAvailable = false;
constructor(root, xref, skipContent = false) {
@ -34020,28 +34014,29 @@ class FileSpec {
}
}
get filename() {
let filename = "";
const item = pickPlatformItem(this.root);
if (item && typeof item === "string") {
filename = stringToPDFString(item).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/");
if (!this._filename && this.root) {
const filename = pickPlatformItem(this.root) || "unnamed";
this._filename = stringToPDFString(filename).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/");
}
return shadow(this, "filename", filename || "unnamed");
return this._filename;
}
get content() {
if (!this.#contentAvailable) {
return null;
}
this._contentRef ||= pickPlatformItem(this.root?.get("EF"));
if (!this.contentRef && this.root) {
this.contentRef = pickPlatformItem(this.root.get("EF"));
}
let content = null;
if (this._contentRef) {
const fileObj = this.xref.fetchIfRef(this._contentRef);
if (this.contentRef) {
const fileObj = this.xref.fetchIfRef(this.contentRef);
if (fileObj instanceof BaseStream) {
content = fileObj.getBytes();
} else {
warn("Embedded file specification points to non-existing/invalid content");
}
} else {
warn("Embedded file specification does not have any content");
warn("Embedded file specification does not have a content");
}
return content;
}
@ -34055,8 +34050,7 @@ class FileSpec {
}
get serializable() {
return {
rawFilename: this.filename,
filename: stripPath(this.filename),
filename: this.filename,
content: this.content,
description: this.description
};
@ -38298,9 +38292,9 @@ class Catalog {
if (urlDict instanceof Dict) {
const fs = new FileSpec(urlDict, null, true);
const {
rawFilename
filename
} = fs.serializable;
url = rawFilename;
url = filename;
} else if (typeof urlDict === "string") {
url = urlDict;
}
@ -55445,7 +55439,7 @@ class WorkerMessageHandler {
docId,
apiVersion
} = docParams;
const workerVersion = "4.3.18";
const workerVersion = "4.3.8";
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@ -56008,8 +56002,8 @@ if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" &&
;// CONCATENATED MODULE: ./src/pdf.worker.js
const pdfjsVersion = "4.3.18";
const pdfjsBuild = "14e87469d";
const pdfjsVersion = "4.3.8";
const pdfjsBuild = "c419c8333";
var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };

Просмотреть файл

@ -5598,6 +5598,7 @@ class PDFPageView {
this.renderingState = RenderingStates.RUNNING;
const canvasWrapper = document.createElement("div");
canvasWrapper.classList.add("canvasWrapper");
canvasWrapper.setAttribute("aria-hidden", true);
this.#addLayer(canvasWrapper, "canvasWrapper");
if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
this._accessibilityManager ||= new TextAccessibilityManager();
@ -5873,7 +5874,7 @@ class PDFViewer {
#scaleTimeoutId = null;
#textLayerMode = TextLayerMode.ENABLE;
constructor(options) {
const viewerVersion = "4.3.18";
const viewerVersion = "4.3.8";
if (version !== viewerVersion) {
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
}
@ -9557,8 +9558,8 @@ function webViewerReportTelemetry({
const pdfjsVersion = "4.3.18";
const pdfjsBuild = "14e87469d";
const pdfjsVersion = "4.3.8";
const pdfjsBuild = "c419c8333";
const AppConstants = null;
window.PDFViewerApplication = PDFViewerApplication;
window.PDFViewerApplicationConstants = AppConstants;

Просмотреть файл

@ -2568,6 +2568,7 @@ class BaseTreeViewer {
;// CONCATENATED MODULE: ./web/pdf_attachment_viewer.js
class PDFAttachmentViewer extends BaseTreeViewer {
constructor(options) {
super(options);
@ -2630,18 +2631,29 @@ class PDFAttachmentViewer extends BaseTreeViewer {
let attachmentsCount = 0;
for (const name in attachments) {
const item = attachments[name];
const content = item.content,
description = item.description,
filename = getFilenameFromUrl(item.filename, true);
const div = document.createElement("div");
div.className = "treeItem";
const element = document.createElement("a");
this._bindLink(element, item);
element.textContent = this._normalizeTextContent(item.filename);
this._bindLink(element, {
content,
description,
filename
});
element.textContent = this._normalizeTextContent(filename);
div.append(element);
fragment.append(div);
attachmentsCount++;
}
this._finishRendering(fragment, attachmentsCount);
}
#appendAttachment(item) {
#appendAttachment({
filename,
content,
description
}) {
const renderedPromise = this._renderedCapability.promise;
renderedPromise.then(() => {
if (renderedPromise !== this._renderedCapability.promise) {
@ -2649,11 +2661,15 @@ class PDFAttachmentViewer extends BaseTreeViewer {
}
const attachments = this._attachments || Object.create(null);
for (const name in attachments) {
if (item.filename === name) {
if (filename === name) {
return;
}
}
attachments[item.filename] = item;
attachments[filename] = {
filename,
content,
description
};
this.render({
attachments,
keepRenderedCapability: true
@ -8162,6 +8178,7 @@ class PDFPageView {
this.renderingState = RenderingStates.RUNNING;
const canvasWrapper = document.createElement("div");
canvasWrapper.classList.add("canvasWrapper");
canvasWrapper.setAttribute("aria-hidden", true);
this.#addLayer(canvasWrapper, "canvasWrapper");
if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) {
this._accessibilityManager ||= new TextAccessibilityManager();
@ -8437,7 +8454,7 @@ class PDFViewer {
#scaleTimeoutId = null;
#textLayerMode = TextLayerMode.ENABLE;
constructor(options) {
const viewerVersion = "4.3.18";
const viewerVersion = "4.3.8";
if (version !== viewerVersion) {
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
}
@ -12647,8 +12664,8 @@ function webViewerReportTelemetry({
const pdfjsVersion = "4.3.18";
const pdfjsBuild = "14e87469d";
const pdfjsVersion = "4.3.8";
const pdfjsBuild = "c419c8333";
const AppConstants = null;
window.PDFViewerApplication = PDFViewerApplication;
window.PDFViewerApplicationConstants = AppConstants;

Просмотреть файл

@ -20,8 +20,8 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: 14e87469dbb04fa0e9e6f7ec23e5c9d7b283e901 (2024-05-06T18:00:03Z).
revision: 14e87469dbb04fa0e9e6f7ec23e5c9d7b283e901
release: c419c8333b1b509fe90242135d9594aa026a8724 (2024-05-02T12:41:02Z).
revision: c419c8333b1b509fe90242135d9594aa026a8724
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/