Merge pull request #12991 from Snuffleupagus/viewer-Firefox-rm-misc-code

Stop including unused/unnecessary code in the viewer, for `MOZCENTRAL`-builds
This commit is contained in:
Tim van der Meij 2021-02-14 15:17:16 +01:00 committed by GitHub
commit f892c00275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 13 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;
@ -1421,7 +1423,10 @@ const PDFViewerApplication = {
pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument });
});
if ("requestIdleCallback" in window) {
if (
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
"requestIdleCallback" in window
) {
const callback = window.requestIdleCallback(
() => {
this._collectTelemetry(pdfDocument);

View File

@ -129,8 +129,6 @@ class PDFCursorTools {
this.eventBus._on("presentationmodechanged", evt => {
switch (evt.state) {
case PresentationModeState.CHANGING:
break;
case PresentationModeState.FULLSCREEN: {
const previouslyActive = this.active;

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",