diff --git a/lib/internal/bootstrap/browser.js b/lib/internal/bootstrap/browser.js index 9e63e0679aca4c..bffdadbe84ea44 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 f33911ea784517..f7511f3c06814f 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 ea68c8562aea57..7900d1ca9a79c6 100644 --- a/test/wpt/test-domexception.js +++ b/test/wpt/test-domexception.js @@ -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();