Skip to content

Commit

Permalink
lib: fix DOMException property descriptors after being lazy
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#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>
  • Loading branch information
sercher committed Apr 24, 2024
1 parent e2c3b41 commit 3ab3f4d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 5 additions & 1 deletion graal-nodejs/lib/internal/bootstrap/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
1 change: 1 addition & 0 deletions graal-nodejs/test/common/wpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ class WPTRunner {

loadLazyGlobals() {
const lazyProperties = [
'DOMException',
'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure',
'PerformanceObserver', 'PerformanceObserverEntryList', 'PerformanceResourceTiming',
'Blob', 'atob', 'btoa',
Expand Down
11 changes: 1 addition & 10 deletions graal-nodejs/test/wpt/test-domexception.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 3ab3f4d

Please sign in to comment.