mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
Catch DOMException when accessing parent origin (#80)
This commit is contained in:
@@ -28,13 +28,19 @@ export class IframeMessagingBridgeElement extends LitElement {
|
||||
#parentOrigin?: string;
|
||||
|
||||
override connectedCallback(): void {
|
||||
if (
|
||||
window.parent
|
||||
&& window.parent !== window
|
||||
&& PARENT_ORIGIN_WHITELIST.includes(window.parent.origin)
|
||||
) {
|
||||
this.#parentWindow = window.parent;
|
||||
this.#parentOrigin = window.parent.origin;
|
||||
try {
|
||||
if (
|
||||
window.parent
|
||||
&& window.parent !== window
|
||||
&& PARENT_ORIGIN_WHITELIST.includes(window.parent.origin)
|
||||
) {
|
||||
this.#parentWindow = window.parent;
|
||||
this.#parentOrigin = window.parent.origin;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
this.#parentWindow = undefined;
|
||||
this.#parentOrigin = undefined;
|
||||
}
|
||||
|
||||
super.connectedCallback();
|
||||
|
||||
Reference in New Issue
Block a user