Commit 883b575
committed
events: remove the abort listener on iterator completion
Given an AbortSignal when passed into the events.on AsyncIterator API
the attached abort listener should always be removed when the iterator
completes.
The abortHandler function is declared within the scope of
the events.on function so cannot be removed by the caller which can lead
to a memory leak. Adding the abort listener using the addEventListener
helper returned by the listenersController helper adds the abort listener
to the array of listeners that will be cleaned up by removeAll in the
closeHandler for the AsyncIterator.
Fixes: #510101 parent af3e2b2 commit 883b575
2 files changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
| 1172 | + | |
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
375 | 398 | | |
376 | 399 | | |
377 | 400 | | |
| |||
391 | 414 | | |
392 | 415 | | |
393 | 416 | | |
| 417 | + | |
394 | 418 | | |
395 | 419 | | |
396 | 420 | | |
| |||
0 commit comments