@@ -14,22 +14,14 @@ const {
14
14
} = require ( 'internal/timers' ) ;
15
15
16
16
const {
17
- hideStackFrames ,
17
+ AbortError ,
18
18
codes : { ERR_INVALID_ARG_TYPE }
19
19
} = require ( 'internal/errors' ) ;
20
20
21
- let DOMException ;
22
-
23
- const lazyDOMException = hideStackFrames ( ( message , name ) => {
24
- if ( DOMException === undefined )
25
- DOMException = internalBinding ( 'messaging' ) . DOMException ;
26
- return new DOMException ( message , name ) ;
27
- } ) ;
28
-
29
21
function cancelListenerHandler ( clear , reject ) {
30
22
if ( ! this . _destroyed ) {
31
23
clear ( this ) ;
32
- reject ( lazyDOMException ( 'The operation was aborted' , ' AbortError' ) ) ;
24
+ reject ( new AbortError ( ) ) ;
33
25
}
34
26
}
35
27
@@ -64,8 +56,7 @@ function setTimeout(after, value, options = {}) {
64
56
// to 12.x, then this can be converted to use optional chaining to
65
57
// simplify the check.
66
58
if ( signal && signal . aborted ) {
67
- return PromiseReject (
68
- lazyDOMException ( 'The operation was aborted' , 'AbortError' ) ) ;
59
+ return PromiseReject ( new AbortError ( ) ) ;
69
60
}
70
61
let oncancel ;
71
62
const ret = new Promise ( ( resolve , reject ) => {
@@ -115,8 +106,7 @@ function setImmediate(value, options = {}) {
115
106
// to 12.x, then this can be converted to use optional chaining to
116
107
// simplify the check.
117
108
if ( signal && signal . aborted ) {
118
- return PromiseReject (
119
- lazyDOMException ( 'The operation was aborted' , 'AbortError' ) ) ;
109
+ return PromiseReject ( new AbortError ( ) ) ;
120
110
}
121
111
let oncancel ;
122
112
const ret = new Promise ( ( resolve , reject ) => {
0 commit comments