Skip to content

Commit

Permalink
lib: fix DOMException property descriptors after being lazy loaded
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
panva authored and targos committed Nov 10, 2023
1 parent cb6ef74 commit 671d2c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 5 additions & 1 deletion 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 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 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 671d2c0

Please sign in to comment.