Skip to content

Commit

Permalink
remove data-attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
turnekybc committed Dec 18, 2024
1 parent c9d54e6 commit 16907cd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/iframe-stamper/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export class IframeStamper {
iframe: HTMLIFrameElement;
iframeOrigin: string;
iframePublicKey: string | null;
trustedParentOrigin: string;
messageChannel: MessageChannel;

/**
Expand Down Expand Up @@ -143,11 +142,9 @@ export class IframeStamper {

let iframe = window.document.createElement("iframe");

this.trustedParentOrigin = window.origin;
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
// We do not need any other permission than running scripts for import/export/auth frames.
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");
iframe.setAttribute("data-trusted-origin", this.trustedParentOrigin);
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin");

iframe.id = config.iframeElementId;
iframe.src = config.iframeUrl;
Expand Down Expand Up @@ -191,8 +188,8 @@ export class IframeStamper {
* Removes the iframe from the DOM
*/
clear() {
this.messageChannel.port1.close();
this.messageChannel.port2.close();
this.messageChannel?.port1?.close();
this.messageChannel?.port2?.close();
this.iframe.remove();
}

Expand Down

0 comments on commit 16907cd

Please sign in to comment.