Skip to content

Commit

Permalink
extension: Don't show CORS error on internal player page
Browse files Browse the repository at this point in the history
The player page is not restricted by CORS
  • Loading branch information
n0samu authored and torokati44 committed Aug 26, 2023
1 parent 359e638 commit 2e73876
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/packages/core/src/ruffle-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,11 @@ export class RufflePlayer extends HTMLElement {
const error = new Error("Failed to fetch: " + this.swfUrl);
if (!this.swfUrl!.protocol.includes("http")) {
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;
} else {
// This is a selfhosted build of Ruffle that tried to make a cross-origin request
Expand Down

0 comments on commit 2e73876

Please sign in to comment.