-
-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extension: Fix some minor issues #12917
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1994,24 +1994,31 @@ export class RufflePlayer extends HTMLElement { | |
}); | ||
} | ||
this.hideSplashScreen(); | ||
|
||
const div = document.createElement("div"); | ||
div.id = "message_overlay"; | ||
const innerDiv = document.createElement("div"); | ||
innerDiv.className = "message"; | ||
innerDiv.innerHTML = textAsParagraphs("message-cant-embed"); | ||
|
||
const buttonDiv = document.createElement("div"); | ||
const link = document.createElement("a"); | ||
link.innerText = text("open-in-new-tab"); | ||
link.onclick = () => openInNewTab(url); | ||
buttonDiv.appendChild(link); | ||
|
||
div.innerHTML = `<div class="message"> | ||
${textAsParagraphs("message-cant-embed")} | ||
<div></div> | ||
</div>`; | ||
div.lastChild!.appendChild(link); | ||
innerDiv.appendChild(buttonDiv); | ||
div.appendChild(innerDiv); | ||
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) { | ||
} else if ( | ||
window.location.origin === this.swfUrl!.origin || | ||
// The extension's internal player page is not restricted by CORS | ||
window.location.protocol.includes("extension") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this part work for Edge? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, Edge's extension protocol is called EDIT: Oh that's funny, Edge actually uses |
||
) { | ||
error.ruffleIndexError = PanicError.SwfFetchError; | ||
} else { | ||
// This is a selfhosted build of Ruffle that tried to make a cross-origin request | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be
innerText
ortextContent
now, right? Or is message-cant-embed an HTML element? We should be moving away frominnerHTML
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no, I see
textAsParagraphs
returns an HTML string. It should return an HTMLDivElement though ideally, so you can justappendChild
the result.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC this should be fixed in #12937, right? Let's merge this as-is for now.