Commit 5cf4ba2
authored
fix: dispatch FrameDetached before detaching frame in FrameManager (#3454)
Mirrors upstream Puppeteer PR #14430 ("perf: dispose sub-classes
correctly"). In the original change, frame disposal was moved to run
after the FrameDetached events fire so that listeners aren't torn down
before they can observe the event.
Most of upstream's changes target TypeScript's disposeSymbol /
asyncDisposeSymbol pattern and an internal EventEmitter that removes
all listeners on dispose. PuppeteerSharp uses standard C# events, which
keep their delegate list intact across Dispose, so the underlying bug
does not manifest the same way. The one place the structural ordering
matters is FrameManager.RemoveFramesRecursively, where Frame.Detach
performs internal cleanup (world detachment, etc.) before emitting
FrameDetached on the frame itself. Reordering aligns us with upstream
and keeps event observability consistent with the rest of the codebase.
Refs: puppeteer/puppeteer#144301 parent 4f8ead1 commit 5cf4ba2
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
580 | 579 | | |
581 | 580 | | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
582 | 585 | | |
583 | 586 | | |
584 | 587 | | |
| |||
0 commit comments