(url: string, functionName: string)
| 317 | } |
| 318 | |
| 319 | function isPromiseAwaitInternal(url: string, functionName: string): boolean { |
| 320 | // Various internals of the JS VM can await internally on a Promise. If those are at |
| 321 | // the top of the stack then we don't want to consider them as internal frames. The |
| 322 | // true "await" conceptually is the thing that called the helper. |
| 323 | // Ideally we'd also include common third party helpers for this. |
| 324 | if (url === 'node:internal/async_hooks') { |
| 325 | // Ignore the stack frames from the async hooks themselves. |
| 326 | return true; |
| 327 | } |
| 328 | if (url !== '') { |
| 329 | return false; |
| 330 | } |
| 331 | switch (functionName) { |
| 332 | case 'Promise.then': |
| 333 | case 'Promise.catch': |
| 334 | case 'Promise.finally': |
| 335 | case 'Function.reject': |
| 336 | case 'Function.resolve': |
| 337 | case 'Function.all': |
| 338 | case 'Function.allSettled': |
| 339 | case 'Function.race': |
| 340 | case 'Function.try': |
| 341 | return true; |
| 342 | default: |
| 343 | return false; |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | export function isAwaitInUserspace( |
| 348 | request: Request, |
no outgoing calls
no test coverage detected