File tree 3 files changed +23
-12
lines changed
3 files changed +23
-12
lines changed Original file line number Diff line number Diff line change @@ -623,6 +623,10 @@ function isURL(self) {
623
623
624
624
class URL {
625
625
constructor ( input , base = undefined ) {
626
+ if ( arguments . length === 0 ) {
627
+ throw new ERR_MISSING_ARGS ( 'url' ) ;
628
+ }
629
+
626
630
// toUSVString is not needed.
627
631
input = `${ input } ` ;
628
632
this [ context ] = new URLContext ( ) ;
Original file line number Diff line number Diff line change 1
- 'use strict' ;
2
-
3
- require ( '../common' ) ;
4
- const assert = require ( 'assert' ) ;
5
-
6
- // One argument is required
7
- assert . throws ( ( ) => {
8
- URL . canParse ( ) ;
9
- } , {
10
- code : 'ERR_MISSING_ARGS' ,
11
- name : 'TypeError'
12
- } ) ;
1
+ 'use strict' ;
2
+
3
+ require ( '../common' ) ;
4
+ const assert = require ( 'assert' ) ;
5
+
6
+ // One argument is required
7
+ assert . throws ( ( ) => {
8
+ URL . canParse ( ) ;
9
+ } , {
10
+ code : 'ERR_MISSING_ARGS' ,
11
+ name : 'TypeError' ,
12
+ } ) ;
Original file line number Diff line number Diff line change @@ -78,3 +78,10 @@ for (const test of additional_tests) {
78
78
if ( test . search ) assert . strictEqual ( url . search , test . search ) ;
79
79
if ( test . hash ) assert . strictEqual ( url . hash , test . hash ) ;
80
80
}
81
+
82
+ assert . throws ( ( ) => {
83
+ new URL ( ) ;
84
+ } , {
85
+ name : 'TypeError' ,
86
+ code : 'ERR_MISSING_ARGS' ,
87
+ } ) ;
You can’t perform that action at this time.
0 commit comments