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

+5-1
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

+1
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

+1-10
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)