Skip to content

Commit 8d9ba7d

Browse files
committed
try
1 parent fc70a43 commit 8d9ba7d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/src/lavadome.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {distraction, loadable, hardened} from './element.mjs';
1818
import {getShadow} from './shadow.mjs';
1919

2020
const teardowns = Array();
21+
const teardownAll = () => map(teardowns, t => t());
2122

2223
// text-fragments links can be abused to leak shadow internals - block in-app redirection to them
2324
navigation?.addEventListener('navigate', event => {
@@ -28,9 +29,11 @@ navigation?.addEventListener('navigate', event => {
2829
throw new Error(
2930
`LavaDomeCore: in-app redirection to text-fragments links is blocked to ensure security`);
3031
}
31-
map(teardowns, teardown => teardown());
32+
teardownAll();
3233
});
3334

35+
addEventListener('pagehide', teardownAll);
36+
3437
export function LavaDome(host, opts) {
3538
opts = options(opts);
3639

0 commit comments

Comments
 (0)