Skip to content

Commit 281f176

Browse files
panvatargos
authored andcommitted
lib: fix DOMException property descriptors after being lazy loaded
PR-URL: #46799 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 2f09d3f commit 281f176

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

lib/internal/bootstrap/browser.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ exposeInterface(globalThis, 'URL', URL);
2626
exposeInterface(globalThis, 'URLSearchParams', URLSearchParams);
2727
exposeGetterAndSetter(globalThis,
2828
'DOMException',
29-
lazyDOMExceptionClass,
29+
() => {
30+
const DOMException = lazyDOMExceptionClass();
31+
exposeInterface(globalThis, 'DOMException', DOMException);
32+
return DOMException;
33+
},
3034
(value) => {
3135
exposeInterface(globalThis, 'DOMException', value);
3236
});

test/common/wpt.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ class WPTRunner {
501501

502502
loadLazyGlobals() {
503503
const lazyProperties = [
504+
'DOMException',
504505
'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure',
505506
'PerformanceObserver', 'PerformanceObserverEntryList', 'PerformanceResourceTiming',
506507
'Blob', 'atob', 'btoa',

test/wpt/test-domexception.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ const { WPTRunner } = require('../common/wpt');
44

55
const runner = new WPTRunner('webidl/ecmascript-binding/es-exceptions');
66

7-
runner.setFlags(['--expose-internals']);
8-
runner.setInitScript(`
9-
const { internalBinding } = require('internal/test/binding');
10-
const { DOMException } = internalBinding('messaging');
11-
Object.defineProperty(global, 'DOMException', {
12-
writable: true,
13-
configurable: true,
14-
value: DOMException,
15-
});
16-
`);
7+
runner.loadLazyGlobals();
178

189
runner.runJsTests();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy