web: Warn about root movie fetch over file protocol
This commit is contained in:
parent
7254d3c110
commit
21c65252f5
|
@ -1466,23 +1466,9 @@ export class RufflePlayer extends HTMLElement {
|
||||||
|
|
||||||
displayRootMovieDownloadFailedMessage(): void {
|
displayRootMovieDownloadFailedMessage(): void {
|
||||||
if (
|
if (
|
||||||
window.location.origin === this.swfUrl!.origin ||
|
this.isExtension &&
|
||||||
!this.isExtension ||
|
window.location.origin !== this.swfUrl!.origin
|
||||||
!window.location.protocol.includes("http")
|
|
||||||
) {
|
) {
|
||||||
const error = new Error("Failed to fetch: " + this.swfUrl);
|
|
||||||
if (
|
|
||||||
window.location.origin !== this.swfUrl!.origin &&
|
|
||||||
!this.isExtension
|
|
||||||
) {
|
|
||||||
error.ruffleIndexError = PanicError.SwfCors;
|
|
||||||
} else {
|
|
||||||
error.ruffleIndexError = PanicError.SwfFetchError;
|
|
||||||
}
|
|
||||||
this.panic(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hidePreloader();
|
this.hidePreloader();
|
||||||
const div = document.createElement("div");
|
const div = document.createElement("div");
|
||||||
div.id = "message_overlay";
|
div.id = "message_overlay";
|
||||||
|
@ -1494,6 +1480,18 @@ export class RufflePlayer extends HTMLElement {
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
this.container.prepend(div);
|
this.container.prepend(div);
|
||||||
|
} else {
|
||||||
|
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) {
|
||||||
|
error.ruffleIndexError = PanicError.SwfFetchError;
|
||||||
|
} else {
|
||||||
|
// This is a selfhosted build of Ruffle that tried to make a cross-origin request
|
||||||
|
error.ruffleIndexError = PanicError.SwfCors;
|
||||||
|
}
|
||||||
|
this.panic(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayUnsupportedMessage(): void {
|
displayUnsupportedMessage(): void {
|
||||||
|
|
Loading…
Reference in New Issue