Stop including the "errorWrapper" HTML code in MOZCENTRAL-builds

Given that these HTML elements are not being used at all in `MOZCENTRAL`-builds, note the preprocessor check in `PDFViewerApplication._otherError`, we obviously don't need the HTML code either.
This commit is contained in:
Jonas Jenwald 2021-02-14 10:39:34 +01:00
parent c79fd71457
commit 7f8a9b12d9
3 changed files with 19 additions and 10 deletions

View File

@ -824,8 +824,10 @@ const PDFViewerApplication = {
async close() {
this._unblockDocumentLoadEvent();
const errorWrapper = this.appConfig.errorWrapper.container;
errorWrapper.hidden = true;
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
const { container } = this.appConfig.errorWrapper;
container.hidden = true;
}
if (!this.pdfLoadingTask) {
return undefined;

View File

@ -320,6 +320,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<div id="viewer" class="pdfViewer"></div>
</div>
<!--#if !MOZCENTRAL-->
<div id="errorWrapper" hidden='true'>
<div id="errorMessageLeft">
<span id="errorMessage"></span>
@ -338,6 +339,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<div class="clearBoth"></div>
<textarea id="errorMoreInfo" hidden='true' readonly="readonly"></textarea>
</div>
<!--#endif-->
</div> <!-- mainContainer -->
<div id="overlayContainer" class="hidden">

View File

@ -61,6 +61,18 @@ if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME || GENERIC")) {
}
function getViewerConfiguration() {
let errorWrapper = null;
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
errorWrapper = {
container: document.getElementById("errorWrapper"),
errorMessage: document.getElementById("errorMessage"),
closeButton: document.getElementById("errorClose"),
errorMoreInfo: document.getElementById("errorMoreInfo"),
moreInfoButton: document.getElementById("errorShowMore"),
lessInfoButton: document.getElementById("errorShowLess"),
};
}
return {
appContainer: document.body,
mainContainer: document.getElementById("viewerContainer"),
@ -177,14 +189,7 @@ function getViewerConfiguration() {
linearized: document.getElementById("linearizedField"),
},
},
errorWrapper: {
container: document.getElementById("errorWrapper"),
errorMessage: document.getElementById("errorMessage"),
closeButton: document.getElementById("errorClose"),
errorMoreInfo: document.getElementById("errorMoreInfo"),
moreInfoButton: document.getElementById("errorShowMore"),
lessInfoButton: document.getElementById("errorShowLess"),
},
errorWrapper,
printContainer: document.getElementById("printContainer"),
openFileInputName: "fileInput",
debuggerScriptPath: "./debugger.js",