extension: Don't show CORS error on internal player page

The player page is not restricted by CORS
This commit is contained in:
nosamu 2023-08-23 06:04:09 -05:00 committed by TÖRÖK Attila
parent 3df6e13848
commit 11a17dfb4e
1 changed files with 5 additions and 1 deletions

View File

@ -2014,7 +2014,11 @@ export class RufflePlayer extends HTMLElement {
const error = new Error("Failed to fetch: " + this.swfUrl); const error = new Error("Failed to fetch: " + this.swfUrl);
if (!this.swfUrl!.protocol.includes("http")) { if (!this.swfUrl!.protocol.includes("http")) {
error.ruffleIndexError = PanicError.FileProtocol; error.ruffleIndexError = PanicError.FileProtocol;
} else if (window.location.origin === this.swfUrl!.origin) { } else if (
window.location.origin === this.swfUrl!.origin ||
// The extension's internal player page is not restricted by CORS
window.location.protocol.includes("extension")
) {
error.ruffleIndexError = PanicError.SwfFetchError; error.ruffleIndexError = PanicError.SwfFetchError;
} else { } else {
// This is a selfhosted build of Ruffle that tried to make a cross-origin request // This is a selfhosted build of Ruffle that tried to make a cross-origin request