mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #14559 from Snuffleupagus/revert-9505
Revert "Don't block origin-less blob:-URLs in hosted viewer"
This commit is contained in:
commit
78246719f8
1 changed files with 2 additions and 5 deletions
|
@ -2127,14 +2127,11 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
|||
// Hosted or local viewer, allow for any file locations
|
||||
return;
|
||||
}
|
||||
const { origin, protocol } = new URL(file, window.location.href);
|
||||
const fileOrigin = new URL(file, window.location.href).origin;
|
||||
// Removing of the following line will not guarantee that the viewer will
|
||||
// start accepting URLs from foreign origin -- CORS headers on the remote
|
||||
// server must be properly configured.
|
||||
// IE10 / IE11 does not include an origin in `blob:`-URLs. So don't block
|
||||
// any blob:-URL. The browser's same-origin policy will block requests to
|
||||
// blob:-URLs from other origins, so this is safe.
|
||||
if (origin !== viewerOrigin && protocol !== "blob:") {
|
||||
if (fileOrigin !== viewerOrigin) {
|
||||
throw new Error("file origin does not match viewer's");
|
||||
}
|
||||
} catch (ex) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue