5151 return Promise . resolve ( src ) ;
5252 }
5353 createPromise ( source ) . then ( v => sink ( v ) ) ; // NOT OK!
54-
54+
5555 var p8 = new Promise ( ( resolve , reject ) => reject ( source ) ) ;
5656 var p9 = p8 . then ( ( ) => { } ) ;
5757 var p10 = p9 . finally ( ( ) => { } ) ;
6969 } catch ( e ) {
7070 sink ( e ) ; // NOT OK!
7171 }
72-
72+
7373 function chainedPromise ( ) {
7474 return new Promise ( ( resolve , reject ) => reject ( source ) ) . then ( ( ) => { } ) ;
7575 }
7676 chainedPromise ( ) . then ( ( ) => { } ) . catch ( e => sink ( e ) ) ; // NOT OK!
77-
77+
7878 function leaksResolvedPromise ( p ) {
7979 p . then ( x => sink ( x ) ) ; // NOT OK!
8080 }
8181 leaksResolvedPromise ( Promise . resolve ( source ) ) ;
82-
82+
8383 function leaksRejectedPromise ( p ) {
8484 p . catch ( e => sink ( e ) ) ; // NOT OK!
8585 }
8686 leaksRejectedPromise ( new Promise ( ( resolve , reject ) => reject ( source ) ) ) ;
87-
87+
8888 function leaksRejectedAgain ( p ) {
8989 ( "foo" , p ) . then ( ( ) => { } ) . catch ( e => sink ( e ) ) ; // NOT OK!
9090 }
9191 leaksRejectedAgain ( new Promise ( ( resolve , reject ) => reject ( source ) ) . then ( ( ) => { } ) ) ;
92-
92+
9393 async function returnsRejected ( p ) {
9494 try {
9595 await p ;
9999 }
100100 var foo = await returnsRejected ( new Promise ( ( resolve , reject ) => reject ( source ) ) ) ;
101101 sink ( foo ) ; // NOT OK!
102-
102+
103103 new Promise ( ( resolve , reject ) => reject ( "BLA" ) ) . catch ( x => { return source } ) . then ( x => sink ( x ) ) ; // NOT OK
104-
104+
105105 new Promise ( ( resolve , reject ) => reject ( "BLA" ) ) . finally ( x => { throw source } ) . catch ( x => sink ( x ) ) ; // NOT OK
106-
106+
107107 var rejected = new Promise ( ( resolve , reject ) => reject ( source ) ) ;
108-
108+
109109 new Promise ( ( resolve , reject ) => reject ( "BLA" ) ) . finally ( x => rejected ) . catch ( x => sink ( x ) ) ; // NOT OK
110-
110+
111111 new Promise ( ( resolve , reject ) => reject ( "BLA" ) ) . catch ( x => rejected ) . then ( x => sink ( x ) ) // OK
112-
112+
113113 new Promise ( ( resolve , reject ) => reject ( "BLA" ) ) . catch ( x => rejected ) . catch ( x => sink ( x ) ) // NOT OK
114-
114+
115115 var resolved = Promise . resolve ( source ) ;
116-
116+
117117 new Promise ( ( resolve , reject ) => reject ( "BLA" ) ) . catch ( x => resolved ) . catch ( x => sink ( x ) ) // OK
118-
118+
119119 new Promise ( ( resolve , reject ) => reject ( "BLA" ) ) . catch ( x => resolved ) . then ( x => sink ( x ) ) // NOT OK
120-
120+
121121 Promise . resolve ( 123 ) . then ( x => resolved ) . catch ( x => sink ( x ) ) // OK
122-
122+
123123 Promise . resolve ( 123 ) . then ( x => resolved ) . then ( x => sink ( x ) ) // NOT OK
124-
124+
125125 Promise . resolve ( 123 ) . then ( x => rejected ) . catch ( x => sink ( x ) ) // NOT OK
126-
126+
127127 Promise . resolve ( 123 ) . then ( x => rejected ) . then ( x => sink ( x ) ) // OK
128-
128+
129129 new Promise ( ( resolve , reject ) => resolve ( resolved ) ) . then ( x => sink ( x ) ) ; // NOT OK
130-
130+
131131 Promise . resolve ( resolved ) . then ( x => sink ( x ) ) ; // NOT OK
132132} ) ( ) ;
133133
134134
135135( async function ( ) {
136136 var source = "source" ;
137-
137+
138138 async function async ( ) {
139139 return source ;
140140 }
141141 sink ( async ( ) ) ; // OK - wrapped in a promise. (NOT OK for taint-tracking configs)
142142 sink ( await async ( ) ) ; // NOT OK
143-
143+
144144 async function throwsAsync ( ) {
145145 throw source ;
146146 }
165165
166166 const foo = bluebird . mapSeries ( source , x => x ) ;
167167 sink ( foo ) ; // NOT OK (for taint-tracking configs)
168- } )
168+ } )
0 commit comments