@@ -52,7 +52,7 @@ const {
5252 globalThis,
5353} = primordials ;
5454const config = internalBinding ( 'config' ) ;
55- const { deprecate } = require ( 'internal/util' ) ;
55+ const { deprecate, lazyDOMExceptionClass } = require ( 'internal/util' ) ;
5656
5757setupProcessObject ( ) ;
5858
@@ -201,6 +201,12 @@ if (!config.noBrowserGlobals) {
201201 exposeInterface ( globalThis , 'URL' , URL ) ;
202202 // https://url.spec.whatwg.org/#urlsearchparams
203203 exposeInterface ( globalThis , 'URLSearchParams' , URLSearchParams ) ;
204+ exposeGetterAndSetter ( globalThis ,
205+ 'DOMException' ,
206+ lazyDOMExceptionClass ,
207+ ( value ) => {
208+ exposeInterface ( globalThis , 'DOMException' , value ) ;
209+ } ) ;
204210
205211 const {
206212 TextEncoder, TextDecoder
@@ -484,6 +490,15 @@ function exposeInterface(target, name, interfaceObject) {
484490 } ) ;
485491}
486492
493+ function exposeGetterAndSetter ( target , name , getter , setter = undefined ) {
494+ ObjectDefineProperty ( target , name , {
495+ enumerable : false ,
496+ configurable : true ,
497+ get : getter ,
498+ set : setter ,
499+ } ) ;
500+ }
501+
487502// https://heycam.github.io/webidl/#define-the-operations
488503function defineOperation ( target , name , method ) {
489504 ObjectDefineProperty ( target , name , {
0 commit comments