From 32b7bbaced73dae45ecdfe6d6a7c63d33e45b630 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 28 Mar 2021 18:15:17 +0200 Subject: [PATCH] Remove the `file://`-URL special-case from `webViewerOpenFileViaURL` Given that *all* data has been loaded on the main-thread, and then transferred to the worker-thread, ever since PR 8617 (almost four years ago) it should no longer be necessary to keep this special-case around. --- web/app.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/web/app.js b/web/app.js index 35ea06607..3a66de48a 100644 --- a/web/app.js +++ b/web/app.js @@ -2276,21 +2276,6 @@ function webViewerInitialized() { function webViewerOpenFileViaURL(file) { if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { - if (file?.lastIndexOf("file:", 0) === 0) { - // file:-scheme. Load the contents in the main thread because QtWebKit - // cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded - // very quickly, so there is no need to set up progress event listeners. - PDFViewerApplication.setTitleUsingUrl(file); - const xhr = new XMLHttpRequest(); - xhr.onload = function () { - PDFViewerApplication.open(new Uint8Array(xhr.response)); - }; - xhr.open("GET", file); - xhr.responseType = "arraybuffer"; - xhr.send(); - return; - } - if (file) { PDFViewerApplication.open(file); }