| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5247ab3 commit 94e0488
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,22 +16,33 @@ const hook = createHook({ | |||
| 16 | 16 | // in https://github.com/nodejs/node/pull/13870#discussion_r124515293, | |
| 17 | 17 | // this should be fine as long as we call asyncTaskCanceled() too. | |
| 18 | 18 | const recurring = true; | |
| 19 | - inspector.asyncTaskScheduled(type, asyncId, recurring); | ||
| 19 | + if (type === 'PROMISE') | ||
| 20 | + this.promiseIds.add(asyncId); | ||
| 21 | + else | ||
| 22 | + inspector.asyncTaskScheduled(type, asyncId, recurring); | ||
| 20 | 23 | }, | |
| 21 | 24 | ||
| 22 | 25 | before(asyncId) { | |
| 26 | + if (this.promiseIds.has(asyncId)) | ||
| 27 | + return; | ||
| 23 | 28 | inspector.asyncTaskStarted(asyncId); | |
| 24 | 29 | }, | |
| 25 | 30 | ||
| 26 | 31 | after(asyncId) { | |
| 32 | + if (this.promiseIds.has(asyncId)) | ||
| 33 | + return; | ||
| 27 | 34 | inspector.asyncTaskFinished(asyncId); | |
| 28 | 35 | }, | |
| 29 | 36 | ||
| 30 | 37 | destroy(asyncId) { | |
| 38 | + if (this.promiseIds.has(asyncId)) | ||
| 39 | + return this.promiseIds.delete(asyncId); | ||
| 31 | 40 | inspector.asyncTaskCanceled(asyncId); | |
| 32 | 41 | }, | |
| 33 | 42 | }); | |
| 34 | 43 | ||
| 44 | + hook.promiseIds = new Set(); | ||
| 45 | + | ||
| 35 | 46 | function enable() { | |
| 36 | 47 | if (config.bits < 64) { | |
| 37 | 48 | // V8 Inspector stores task ids as (void*) pointers. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,7 +54,7 @@ function debuggerPausedAt(msg, functionName, previousTickLocation) { | |||
| 54 | 54 | `${Object.keys(msg.params)} contains "asyncStackTrace" property`); | |
| 55 | 55 | ||
| 56 | 56 | assert.strictEqual(msg.params.callFrames[0].functionName, functionName); | |
| 57 | - assert.strictEqual(msg.params.asyncStackTrace.description, 'PROMISE'); | ||
| 57 | + assert.strictEqual(msg.params.asyncStackTrace.description, 'Promise.resolve'); | ||
| 58 | 58 | ||
| 59 | 59 | const frameLocations = msg.params.asyncStackTrace.callFrames.map( | |
| 60 | 60 | (frame) => `${frame.functionName}:${frame.lineNumber}`); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments