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