File tree 2 files changed +11
-15
lines changed
2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ const {
21
21
22
22
const {
23
23
codes : {
24
- ERR_INVALID_THIS ,
25
24
ERR_MISSING_ARGS ,
26
25
} ,
27
26
} = require ( 'internal/errors' ) ;
@@ -64,18 +63,10 @@ class File extends Blob {
64
63
}
65
64
66
65
get name ( ) {
67
- if ( ! this || ! ( #name in this ) ) {
68
- throw new ERR_INVALID_THIS ( 'File' ) ;
69
- }
70
-
71
66
return this . #name;
72
67
}
73
68
74
69
get lastModified ( ) {
75
- if ( ! this || ! ( #name in this ) ) {
76
- throw new ERR_INVALID_THIS ( 'File' ) ;
77
- }
78
-
79
70
return this . #lastModified;
80
71
}
81
72
Original file line number Diff line number Diff line change @@ -146,10 +146,15 @@ const { inspect } = require('util');
146
146
147
147
{
148
148
const getter = Object . getOwnPropertyDescriptor ( File . prototype , 'name' ) . get ;
149
- assert . throws (
150
- ( ) => getter . call ( undefined ) , // eslint-disable-line no-useless-call
151
- {
152
- code : 'ERR_INVALID_THIS' ,
153
- }
154
- ) ;
149
+
150
+ [
151
+ undefined ,
152
+ null ,
153
+ true ,
154
+ ] . forEach ( ( invalidThis ) => {
155
+ assert . throws (
156
+ ( ) => getter . call ( invalidThis ) ,
157
+ TypeError
158
+ ) ;
159
+ } ) ;
155
160
}
You can’t perform that action at this time.
0 commit comments