From ceec93c8326f3b413ddf9e4ec1b92befaa959023 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 2 Mar 2023 15:12:01 +0100 Subject: [PATCH] [api-minor] Remove calling `getDocument` directly with a `PDFDataRangeTransport`-instance (PR 15943 follow-up) This was deprecated in PR 15943, which has now been included in two official PDF.js releases. Given that `PDFDataRangeTransport` is somewhat unlikely to be used outside of the *built-in* Firefox PDF Viewer, it doesn't seem necessary to wait longer before removing this. Also, removes the specific error-message for GENERIC builds to not unnecessarily "advertise" using non-objects when calling the `getDocument`-function. *Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly. --- src/display/api.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index 6416a1ef6..521142c0a 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -255,21 +255,9 @@ function getDocument(src) { src = { url: src }; } else if (isArrayBuffer(src)) { src = { data: src }; - } else if (src instanceof PDFDataRangeTransport) { - deprecated( - "`PDFDataRangeTransport`-instance, " + - "please use a parameter object with `range`-property instead." - ); - src = { range: src }; - } else { - if (typeof src !== "object") { - throw new Error( - "Invalid parameter in getDocument, " + - "need either string, URL, TypedArray, or parameter object." - ); - } } - } else if (typeof src !== "object") { + } + if (typeof src !== "object") { throw new Error("Invalid parameter in getDocument, need parameter object."); } if (!src.url && !src.data && !src.range) {