From ade692ff2e1fe86e635c9fe571afe3f5ee1a1d44 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 12 Nov 2023 09:22:59 +0100 Subject: [PATCH] Set a type for the `Blob` used in `createCDNWrapper` (issue 17259) Hopefully this is enough to address the problem of initializing the Worker in Chromium-based browsers. Locally I've tried to *force* use of `createCDNWrapper` in development mode, by commenting out the `isSameOrigin` checks, and worker-loading fails against `master` and works with this patch. --- src/display/api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/display/api.js b/src/display/api.js index 4cd74a301..ada62580a 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -2008,7 +2008,9 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { // We want this function to fail in case if createObjectURL or Blob do not // exist or fail for some reason -- our Worker creation will fail anyway. const wrapper = `await import("${url}");`; - return URL.createObjectURL(new Blob([wrapper])); + return URL.createObjectURL( + new Blob([wrapper], { type: "text/javascript" }) + ); }; }