File tree 5 files changed +34
-3
lines changed
5 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -811,6 +811,11 @@ added: v0.0.1
811
811
812
812
<!-- YAML
813
813
added: v17.0.0
814
+ changes:
815
+ - version: REPLACEME
816
+ pr-url: https://github.com/nodejs/node/pull/47214
817
+ description: Throws a DOM exception when used with `URL` and
818
+ `URLSearhParams` to conform with WHATWG specification.
814
819
-->
815
820
816
821
<!-- type=global -->
Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ added:
111
111
- v7.0.0
112
112
- v6.13.0
113
113
changes:
114
+ - version: REPLACEME
115
+ pr-url: https://github.com/nodejs/node/pull/47214
116
+ description: The class is now not serializable/deserializable through
117
+ `structuredClone` to conform to the WHATWG specification.
114
118
- version: v10.0.0
115
119
pr-url: https://github.com/nodejs/node/pull/18281
116
120
description: The class is now available on the global object.
@@ -669,6 +673,10 @@ added:
669
673
- v7.5.0
670
674
- v6.13.0
671
675
changes:
676
+ - version: REPLACEME
677
+ pr-url: https://github.com/nodejs/node/pull/47214
678
+ description: The class is now not serializable/deserializable through
679
+ `structuredClone` to conform to the WHATWG specification.
672
680
- version: v10.0.0
673
681
pr-url: https://github.com/nodejs/node/pull/18281
674
682
description: The class is now available on the global object.
Original file line number Diff line number Diff line change @@ -4,17 +4,36 @@ const {
4
4
codes : { ERR_MISSING_ARGS } ,
5
5
} = require ( 'internal/errors' ) ;
6
6
7
+ const {
8
+ lazyDOMException,
9
+ } = require ( 'internal/util' ) ;
10
+
7
11
const {
8
12
MessageChannel,
9
13
receiveMessageOnPort,
10
14
} = require ( 'internal/worker/io' ) ;
11
15
16
+ const {
17
+ isURL,
18
+ isURLSearchParams,
19
+ } = require ( 'internal/url' ) ;
20
+
12
21
let channel ;
13
22
function structuredClone ( value , options = undefined ) {
14
23
if ( arguments . length === 0 ) {
15
24
throw new ERR_MISSING_ARGS ( 'value' ) ;
16
25
}
17
26
27
+ if ( isURL ( value ) ) {
28
+ throw new lazyDOMException (
29
+ 'URL: no structured serialize/deserialize support' ,
30
+ 'DataCloneError' ) ;
31
+ } else if ( isURLSearchParams ( value ) ) {
32
+ throw new lazyDOMException (
33
+ 'URLSearchParams: no structured serialize/deserialize support' ,
34
+ 'DataCloneError' ) ;
35
+ }
36
+
18
37
// TODO: Improve this with a more efficient solution that avoids
19
38
// instantiating a MessageChannel
20
39
channel ??= new MessageChannel ( ) ;
Original file line number Diff line number Diff line change @@ -1279,4 +1279,5 @@ module.exports = {
1279
1279
urlToHttpOptions,
1280
1280
encodeStr,
1281
1281
isURL,
1282
+ isURLSearchParams,
1282
1283
} ;
Original file line number Diff line number Diff line change 11
11
"fail" : {
12
12
"note" : " We are faking location with a URL object for the sake of the testharness and it has searchParams." ,
13
13
"expected" : [
14
- " searchParams on location object" ,
15
- " URL: no structured serialize/deserialize support" ,
16
- " URLSearchParams: no structured serialize/deserialize support"
14
+ " searchParams on location object"
17
15
]
18
16
}
19
17
},
You can’t perform that action at this time.
0 commit comments