Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
fix(IFrameWindow): wait for iframe content to unload before removing …
Browse files Browse the repository at this point in the history
…from DOM
  • Loading branch information
kherock committed Jan 16, 2022
1 parent 74ee0bc commit dea5ca0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/navigators/IFrameWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ export class IFrameWindow extends AbstractChildWindow {
close(): void {
if (this._frame) {
if (this._frame.parentNode) {
this._frame.parentNode.removeChild(this._frame);
this._abort.raise(new Error("IFrame removed from DOM"));
this._frame.addEventListener("load", (ev) => {
const frame = ev.target as HTMLIFrameElement;
frame.parentNode?.removeChild(frame);
this._abort.raise(new Error("IFrame removed from DOM"));
}, true);
this._frame.contentWindow?.location.replace("about:blank");
}
this._frame = null;
}
Expand Down

0 comments on commit dea5ca0

Please sign in to comment.