diff --git a/lib/internal/bootstrap/browser.js b/lib/internal/bootstrap/browser.js index b94ac9891a399c..e1f3d775c6ac13 100644 --- a/lib/internal/bootstrap/browser.js +++ b/lib/internal/bootstrap/browser.js @@ -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); }); diff --git a/test/common/wpt.js b/test/common/wpt.js index 964862248c91c9..d96a2ff4c4128d 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -503,6 +503,7 @@ class WPTRunner { loadLazyGlobals() { const lazyProperties = [ + 'DOMException', 'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure', 'PerformanceObserver', 'PerformanceObserverEntryList', 'PerformanceResourceTiming', 'Blob', 'atob', 'btoa', diff --git a/test/wpt/test-domexception.js b/test/wpt/test-domexception.js index 09018a25ac58d8..5341732fe69e25 100644 --- a/test/wpt/test-domexception.js +++ b/test/wpt/test-domexception.js @@ -5,15 +5,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();