Skip to content

Commit 6bad92f

Browse files
authored
fix: [#1800] Fixes issue where browse frame is null during teardown of Window in HTMLLinkElement (#1831)
1 parent d1182cb commit 6bad92f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/happy-dom/src/nodes/html-link-element/HTMLLinkElement.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ export default class HTMLLinkElement extends HTMLElement {
334334
async #preloadResource(url: string): Promise<void> {
335335
const window = this[PropertySymbol.window];
336336
const browserFrame = new WindowBrowserContext(window).getBrowserFrame();
337-
const browserSettings = browserFrame.page?.context?.browser?.settings;
338337
const as = this.as;
339338

340339
// Only "script", "style" and "fetch" are supported for now.
@@ -346,6 +345,8 @@ export default class HTMLLinkElement extends HTMLElement {
346345
return;
347346
}
348347

348+
const browserSettings = browserFrame.page?.context?.browser?.settings;
349+
349350
if (
350351
as === 'script' &&
351352
(browserSettings.disableJavaScriptFileLoading || browserSettings.disableJavaScriptEvaluation)

0 commit comments

Comments
 (0)