Skip to content

Commit 87b002c

Browse files
committed
Remove code-paths only relevant for IE 11/Edge (non-Chromium based) from the web/ folder
This patch purposely starts small, by removing IE-specific code from various JS/CSS files in the `web/` folder. There's obviously lots of potential for additional clean-up, especially the removal of no longer necessary polyfills in `src/shared/compatibility.js`, however that will require some care considering that certain polyfills may also be necessary for e.g. Node.js or the Chromium-extension as well. Generally speaking, once we start removing polyfills it's probably a good idea to consult the compatibility information on https://developer.mozilla.org/ and also https://caniuse.com/ first. (Deciding on the lowest supported Chromium version, for the extension, would also seem like a good idea.)
1 parent 4caa14b commit 87b002c

9 files changed

+9
-47
lines changed

web/app.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,13 @@ const PDFViewerApplication = {
611611
support = !!(
612612
doc.requestFullscreen ||
613613
doc.mozRequestFullScreen ||
614-
doc.webkitRequestFullScreen ||
615-
doc.msRequestFullscreen
614+
doc.webkitRequestFullScreen
616615
);
617616

618617
if (
619618
document.fullscreenEnabled === false ||
620619
document.mozFullScreenEnabled === false ||
621-
document.webkitFullscreenEnabled === false ||
622-
document.msFullscreenEnabled === false
620+
document.webkitFullscreenEnabled === false
623621
) {
624622
support = false;
625623
}

web/download_manager.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function download(blobUrl, filename) {
3535
if ("download" in a) {
3636
a.download = filename;
3737
}
38-
// <a> must be in the document for IE and recent Firefox versions,
38+
// <a> must be in the document for recent Firefox versions,
3939
// otherwise .click() is ignored.
4040
(document.body || document.documentElement).appendChild(a);
4141
a.click();
@@ -51,11 +51,6 @@ class DownloadManager {
5151
}
5252

5353
downloadData(data, filename, contentType) {
54-
if (navigator.msSaveBlob) {
55-
// IE10 and above
56-
navigator.msSaveBlob(new Blob([data], { type: contentType }), filename);
57-
return;
58-
}
5954
const blobUrl = createObjectURL(
6055
data,
6156
contentType,
@@ -71,14 +66,6 @@ class DownloadManager {
7166
* the "open with" dialog.
7267
*/
7368
download(blob, url, filename, sourceEventType = "download") {
74-
if (navigator.msSaveBlob) {
75-
// IE10 / IE11
76-
if (!navigator.msSaveBlob(blob, filename)) {
77-
this.downloadUrl(url, filename);
78-
}
79-
return;
80-
}
81-
8269
if (viewerCompatibilityParams.disableCreateObjectURL) {
8370
// URL.createObjectURL is not supported
8471
this.downloadUrl(url, filename);

web/grab_to_pan.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ GrabToPan.prototype = {
180180

181181
// Get the correct (vendor-prefixed) name of the matches method.
182182
let matchesSelector;
183-
["webkitM", "mozM", "msM", "oM", "m"].some(function (prefix) {
183+
["webkitM", "mozM", "oM", "m"].some(function (prefix) {
184184
let name = prefix + "atches";
185185
if (name in document.documentElement) {
186186
matchesSelector = name;

web/pdf_presentation_mode.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ class PDFPresentationMode {
9292
this.container.mozRequestFullScreen();
9393
} else if (this.container.webkitRequestFullscreen) {
9494
this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
95-
} else if (this.container.msRequestFullscreen) {
96-
this.container.msRequestFullscreen();
9795
} else {
9896
return false;
9997
}
@@ -151,8 +149,7 @@ class PDFPresentationMode {
151149
return !!(
152150
document.fullscreenElement ||
153151
document.mozFullScreen ||
154-
document.webkitIsFullScreen ||
155-
document.msFullscreenElement
152+
document.webkitIsFullScreen
156153
);
157154
}
158155

@@ -478,7 +475,6 @@ class PDFPresentationMode {
478475
"webkitfullscreenchange",
479476
this.fullscreenChangeBind
480477
);
481-
window.addEventListener("MSFullscreenChange", this.fullscreenChangeBind);
482478
}
483479
}
484480

@@ -496,10 +492,6 @@ class PDFPresentationMode {
496492
"webkitfullscreenchange",
497493
this.fullscreenChangeBind
498494
);
499-
window.removeEventListener(
500-
"MSFullscreenChange",
501-
this.fullscreenChangeBind
502-
);
503495
}
504496

505497
delete this.fullscreenChangeBind;

web/pdf_print_service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ window.addEventListener(
341341

342342
if ("onbeforeprint" in window) {
343343
// Do not propagate before/afterprint events when they are not triggered
344-
// from within this polyfill. (FF /IE / Chrome 63+).
344+
// from within this polyfill. (FF / Chrome 63+).
345345
const stopPropagationIfNeeded = function (event) {
346346
if (event.detail !== "custom" && event.stopImmediatePropagation) {
347347
event.stopImmediatePropagation();

web/pdf_viewer.css

-4
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@
124124
margin-right: auto;
125125
}
126126

127-
.pdfPresentationMode:-ms-fullscreen .pdfViewer .page {
128-
margin-bottom: 100% !important;
129-
}
130-
131127
.pdfPresentationMode:fullscreen .pdfViewer .page {
132128
margin-bottom: 100%;
133129
border: 0;

web/ui_utils.js

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ function getOutputScale(ctx) {
9999
const backingStoreRatio =
100100
ctx.webkitBackingStorePixelRatio ||
101101
ctx.mozBackingStorePixelRatio ||
102-
ctx.msBackingStorePixelRatio ||
103102
ctx.oBackingStorePixelRatio ||
104103
ctx.backingStorePixelRatio ||
105104
1;

web/viewer.css

-9
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,6 @@ select {
203203
cursor: not-allowed;
204204
}
205205

206-
#viewerContainer.pdfPresentationMode:-ms-fullscreen {
207-
top: 0px !important;
208-
overflow: hidden !important;
209-
}
210-
211-
#viewerContainer.pdfPresentationMode:-ms-fullscreen::-ms-backdrop {
212-
background-color: rgba(0, 0, 0, 1);
213-
}
214-
215206
#viewerContainer.pdfPresentationMode:fullscreen {
216207
top: 0px;
217208
border-top: 2px solid rgba(0, 0, 0, 0);

web/viewer_compatibility.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
2323
(typeof navigator !== "undefined" && navigator.maxTouchPoints) || 1;
2424

2525
const isAndroid = /Android/.test(userAgent);
26-
const isIE = /Trident/.test(userAgent);
2726
const isIOS =
2827
/\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||
2928
(platform === "MacIntel" && maxTouchPoints > 1);
@@ -32,9 +31,9 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
3231
// Checks if possible to use URL.createObjectURL()
3332
// Support: IE, Chrome on iOS
3433
(function checkOnBlobSupport() {
35-
// Sometimes IE and Chrome on iOS losing the data created with
36-
// createObjectURL(), see issues #3977 and #8081.
37-
if (isIE || isIOSChrome) {
34+
// Sometimes Chrome on iOS loses data created with createObjectURL(),
35+
// see issue #8081.
36+
if (isIOSChrome) {
3837
compatibilityParams.disableCreateObjectURL = true;
3938
}
4039
})();

0 commit comments

Comments
 (0)