Skip to content

Commit

Permalink
chore: [#1451] Continue on implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 committed May 29, 2024
1 parent 9ad642c commit 7442c8d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/happy-dom/src/browser/utilities/BrowserFrameFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export default class BrowserFrameFactory {
}

if (!frame.childFrames.length) {
if (frame.window && frame.window[PropertySymbol.mutationObservers]) {
for (const mutationObserver of frame.window[PropertySymbol.mutationObservers]) {
mutationObserver.disconnect();
}
frame.window[PropertySymbol.mutationObservers] = [];
}
return frame[PropertySymbol.asyncTaskManager]
.destroy()
.then(() => {
Expand All @@ -60,6 +66,12 @@ export default class BrowserFrameFactory {

Promise.all(frame.childFrames.slice().map((childFrame) => this.destroyFrame(childFrame)))
.then(() => {
if (frame.window && frame.window[PropertySymbol.mutationObservers]) {
for (const mutationObserver of frame.window[PropertySymbol.mutationObservers]) {
mutationObserver.disconnect();
}
frame.window[PropertySymbol.mutationObservers] = [];
}
return frame[PropertySymbol.asyncTaskManager].destroy().then(() => {
frame[PropertySymbol.exceptionObserver]?.disconnect();
if (frame.window) {
Expand Down

0 comments on commit 7442c8d

Please sign in to comment.