@@ -52,7 +52,7 @@ const {
52
52
globalThis,
53
53
} = primordials ;
54
54
const config = internalBinding ( 'config' ) ;
55
- const { deprecate } = require ( 'internal/util' ) ;
55
+ const { deprecate, lazyDOMExceptionClass } = require ( 'internal/util' ) ;
56
56
57
57
setupProcessObject ( ) ;
58
58
@@ -201,6 +201,12 @@ if (!config.noBrowserGlobals) {
201
201
exposeInterface ( globalThis , 'URL' , URL ) ;
202
202
// https://url.spec.whatwg.org/#urlsearchparams
203
203
exposeInterface ( globalThis , 'URLSearchParams' , URLSearchParams ) ;
204
+ exposeGetterAndSetter ( globalThis ,
205
+ 'DOMException' ,
206
+ lazyDOMExceptionClass ,
207
+ ( value ) => {
208
+ exposeInterface ( globalThis , 'DOMException' , value ) ;
209
+ } ) ;
204
210
205
211
const {
206
212
TextEncoder, TextDecoder
@@ -483,6 +489,15 @@ function exposeInterface(target, name, interfaceObject) {
483
489
} ) ;
484
490
}
485
491
492
+ function exposeGetterAndSetter ( target , name , getter , setter = undefined ) {
493
+ ObjectDefineProperty ( target , name , {
494
+ enumerable : false ,
495
+ configurable : true ,
496
+ get : getter ,
497
+ set : setter ,
498
+ } ) ;
499
+ }
500
+
486
501
// https://heycam.github.io/webidl/#define-the-operations
487
502
function defineOperation ( target , name , method ) {
488
503
ObjectDefineProperty ( target , name , {
0 commit comments