@@ -221,6 +221,10 @@ class URL {
221221 parse ( this , input , base ) ;
222222 }
223223
224+ get [ Symbol . toStringTag ] ( ) {
225+ return this instanceof URL ? 'URL' : 'URLPrototype' ;
226+ }
227+
224228 get [ special ] ( ) {
225229 return ( this [ context ] . flags & binding . URL_FLAGS_SPECIAL ) !== 0 ;
226230 }
@@ -640,15 +644,11 @@ class URLSearchParams {
640644
641645 // "associated url object"
642646 this [ context ] = null ;
647+ }
643648
644- // Class string for an instance of URLSearchParams. This is different from
645- // the class string of the prototype object (set below).
646- Object . defineProperty ( this , Symbol . toStringTag , {
647- value : 'URLSearchParams' ,
648- writable : false ,
649- enumerable : false ,
650- configurable : true
651- } ) ;
649+ get [ Symbol . toStringTag ] ( ) {
650+ return this instanceof URLSearchParams ?
651+ 'URLSearchParams' : 'URLSearchParamsPrototype' ;
652652 }
653653
654654 append ( name , value ) {
@@ -803,12 +803,6 @@ class URLSearchParams {
803803}
804804// https://heycam.github.io/webidl/#es-iterable-entries
805805URLSearchParams . prototype [ Symbol . iterator ] = URLSearchParams . prototype . entries ;
806- Object . defineProperty ( URLSearchParams . prototype , Symbol . toStringTag , {
807- value : 'URLSearchParamsPrototype' ,
808- writable : false ,
809- enumerable : false ,
810- configurable : true
811- } ) ;
812806
813807// https://heycam.github.io/webidl/#dfn-default-iterator-object
814808function createSearchParamsIterator ( target , kind ) {
0 commit comments