File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed 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