From d1adab8c7b9724ffd4e3111e7e64ac9df7ed5802 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 29 Apr 2023 08:58:44 +0200 Subject: [PATCH] [api-minor] Update the minimum supported Safari version to 15.4 This patch updates the minimum supported browsers as follows: - Safari 15.4, which was released on 2022-03-15; see https://en.wikipedia.org/wiki/Safari_version_history#Safari_15 Nowadays we usually we try, where feasible and possible, to support browsers that are about two years old. The reasons for limiting support to a *somewhat* more recent Safari version include: - Throughout the history of the PDF.js project, Safari has always been the worst browser to attempt to support. Compared to other browsers there's a disproportionate number of bugs affecting Safari, especially on iOS, and in most cases those are browser-specific issues that we simply cannot address.[1] - Safari has often been a lot slower, compared to other browsers, at implementing new web-platform features. Historically this has sometimes blocked usage of new features, for the benefit of the Firefox PDF Viewer, and it's very often meant having to include and maintain polyfills *only* for Safari. - The current (minimum) supported Safari version lack enough functionality that polyfills placed in the `src/shared/compatibility.js` file are unfortunately not sufficient, but it also requires a bunch of special-cases in both the `gulpfile` and in the `web/`-code. - Given that the *built-in* Firefox PDF Viewer is the primary development target for the PDF.js library, and the general development pace these days, we need to limit the maintenance "overhead" caused by other browsers. --- [1] In a few cases a work-around might be possible, however it'd negatively affect e.g. performance, readability, and/or maintainability of the code. --- gulpfile.js | 2 +- src/shared/compatibility.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 71bd903a4..c49839163 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -79,7 +79,7 @@ const ENV_TARGETS = [ "last 2 versions", "Chrome >= 88", "Firefox ESR", - "Safari >= 14.1", + "Safari >= 15.4", "Node >= 18", "> 1%", "not IE > 0", diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index cf623e0c5..641cc431e 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -36,7 +36,7 @@ import { isNodeJS } from "./is_node.js"; polyfillPath2D(globalThis); })(); -// Support: Chrome<92, Safari<15.4 +// Support: Chrome<92 (function checkArrayAt() { if (Array.prototype.at) { return; @@ -44,7 +44,7 @@ import { isNodeJS } from "./is_node.js"; require("core-js/es/array/at.js"); })(); -// Support: Chrome<92, Safari<15.4 +// Support: Chrome<92 (function checkTypedArrayAt() { if (Uint8Array.prototype.at) { return; @@ -52,7 +52,7 @@ import { isNodeJS } from "./is_node.js"; require("core-js/es/typed-array/at.js"); })(); -// Support: Chrome<98, Safari<15.4 +// Support: Chrome<98 (function checkStructuredClone() { if (globalThis.structuredClone) { return;