Commit 3eaa593
async_wrap: correctly pass parent to init callback
Previous logic didn't allow parent to propagate to the init callback
properly. The fix now allows the init callback to be called and receive
the parent if:
- async wrap callbacks are enabled and parent exists
- the init callback has been called on the parent and an init callback
exists then it will be called regardless of whether async wrap
callbacks are disabled.
Change the init/pre/post callback checks to see if it has been properly
set. This allows removal of the Environment "using_asyncwrap" variable.
Pass Isolate to a TryCatch instance.
Fixes: #2986
PR-URL: #3216
Reviewed-By: Rod Vagg <rod@vagg.org>1 parent 28aac7f commit 3eaa593Copy full SHA for 3eaa593
File tree
Expand file treeCollapse file tree
8 files changed
+131
-40
lines changedOpen diff view settings
Filter options
- src
- test/parallel
Expand file treeCollapse file tree
8 files changed
+131
-40
lines changedOpen diff view settings
Collapse file
+20-13Lines changed: 20 additions & 13 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | | - |
28 | | - |
29 | | - |
| 27 | + |
30 | 28 | |
31 | | - |
32 | | - |
| 29 | + |
| 30 | + |
33 | 31 | |
34 | 32 | |
35 | | - |
36 | | - |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | | - |
41 | 40 | |
42 | | - |
43 | | - |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
44 | 51 | |
45 | | - |
| 52 | + |
46 | 53 | |
47 | 54 | |
48 | | - |
| 55 | + |
49 | 56 | |
50 | 57 | |
51 | 58 | |
52 | | - |
| 59 | + |
53 | 60 | |
54 | 61 | |
55 | 62 | |
|
Collapse file
+11-7Lines changed: 11 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
123 | 123 | |
124 | 124 | |
125 | 125 | |
126 | | - |
127 | | - |
128 | 126 | |
129 | 127 | |
130 | 128 | |
| ||
146 | 144 | |
147 | 145 | |
148 | 146 | |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
149 | 151 | |
150 | 152 | |
151 | 153 | |
| ||
164 | 166 | |
165 | 167 | |
166 | 168 | |
| 169 | + |
| 170 | + |
167 | 171 | |
168 | 172 | |
169 | 173 | |
| ||
179 | 183 | |
180 | 184 | |
181 | 185 | |
182 | | - |
| 186 | + |
183 | 187 | |
184 | 188 | |
185 | 189 | |
| ||
191 | 195 | |
192 | 196 | |
193 | 197 | |
194 | | - |
| 198 | + |
195 | 199 | |
196 | | - |
| 200 | + |
197 | 201 | |
198 | 202 | |
199 | 203 | |
| ||
205 | 209 | |
206 | 210 | |
207 | 211 | |
208 | | - |
| 212 | + |
209 | 213 | |
210 | | - |
| 214 | + |
211 | 215 | |
212 | 216 | |
213 | 217 | |
|
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | | - |
| 73 | + |
74 | 74 | |
75 | 75 | |
76 | 76 | |
|
Collapse file
-9Lines changed: 0 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
208 | 208 | |
209 | 209 | |
210 | 210 | |
211 | | - |
212 | 211 | |
213 | 212 | |
214 | 213 | |
| ||
348 | 347 | |
349 | 348 | |
350 | 349 | |
351 | | - |
352 | | - |
353 | | - |
354 | | - |
355 | | - |
356 | | - |
357 | | - |
358 | | - |
359 | 350 | |
360 | 351 | |
361 | 352 | |
|
Collapse file
-4Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
435 | 435 | |
436 | 436 | |
437 | 437 | |
438 | | - |
439 | | - |
440 | | - |
441 | 438 | |
442 | 439 | |
443 | 440 | |
| ||
537 | 534 | |
538 | 535 | |
539 | 536 | |
540 | | - |
541 | 537 | |
542 | 538 | |
543 | 539 | |
|
Collapse file
+10-6Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1040 | 1040 | |
1041 | 1041 | |
1042 | 1042 | |
| 1043 | + |
| 1044 | + |
1043 | 1045 | |
1044 | | - |
| 1046 | + |
1045 | 1047 | |
1046 | 1048 | |
| 1049 | + |
| 1050 | + |
1047 | 1051 | |
1048 | 1052 | |
1049 | 1053 | |
1050 | 1054 | |
1051 | | - |
| 1055 | + |
1052 | 1056 | |
1053 | 1057 | |
1054 | 1058 | |
| ||
1074 | 1078 | |
1075 | 1079 | |
1076 | 1080 | |
1077 | | - |
| 1081 | + |
1078 | 1082 | |
1079 | | - |
| 1083 | + |
1080 | 1084 | |
1081 | 1085 | |
1082 | 1086 | |
1083 | 1087 | |
1084 | 1088 | |
1085 | 1089 | |
1086 | 1090 | |
1087 | | - |
| 1091 | + |
1088 | 1092 | |
1089 | | - |
| 1093 | + |
1090 | 1094 | |
1091 | 1095 | |
1092 | 1096 | |
|
Collapse file
test/parallel/test-async-wrap-disabled-propagate-parent.js
Copy file name to clipboard+46Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
Collapse file
test/parallel/test-async-wrap-propagate-parent.js
Copy file name to clipboard+43Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
0 commit comments