lib: fix DOMException property descriptors after being lazy loaded

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Filip Skokan 2023-02-25 18:02:59 +01:00 committed by GitHub
parent ea1dd1ba1f
commit f85113bf1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 11 deletions

View File

@ -26,7 +26,11 @@ exposeInterface(globalThis, 'URL', URL);
exposeInterface(globalThis, 'URLSearchParams', URLSearchParams);
exposeGetterAndSetter(globalThis,
'DOMException',
lazyDOMExceptionClass,
() => {
const DOMException = lazyDOMExceptionClass();
exposeInterface(globalThis, 'DOMException', DOMException);
return DOMException;
},
(value) => {
exposeInterface(globalThis, 'DOMException', value);
});

View File

@ -501,6 +501,7 @@ class WPTRunner {
loadLazyGlobals() {
const lazyProperties = [
'DOMException',
'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure',
'PerformanceObserver', 'PerformanceObserverEntryList', 'PerformanceResourceTiming',
'Blob', 'atob', 'btoa',

View File

@ -4,15 +4,6 @@ const { WPTRunner } = require('../common/wpt');
const runner = new WPTRunner('webidl/ecmascript-binding/es-exceptions');
runner.setFlags(['--expose-internals']);
runner.setInitScript(`
const { internalBinding } = require('internal/test/binding');
const { DOMException } = internalBinding('messaging');
Object.defineProperty(global, 'DOMException', {
writable: true,
configurable: true,
value: DOMException,
});
`);
runner.loadLazyGlobals();
runner.runJsTests();