-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test coverage for event listener leaking (#455)
* Add test coverage for event listener leaking Add test coverage to [#454][]. While the original fix was important to ship, it was unclear how to guard against re-introducing the leaks. This commit introduces the `withoutChangingEventListenersCount()` test helper to wrap a block within the test harness. While executing within the block, the driven page's `document.addEventListener` and `document.removeEventListener` functions are replaced with decorated functions that increment and decrement a counter. At the start of the block, capture and return how many times `addEventListener` has been invoked without a matching `removeEventListener`. At the end, capture and return the differential. [#454]: #454 * Move the `disconnectedCallback()` call The fix introduced in [#454][] resolved the issue, but introduced a matching `disconnectedCallback()` far-off in the `FrameRenderer`. This commit moves that call to occur _immediately_ after it's paired `element.connectedCallback()`. [#454]: #454 Co-authored-by: David Heinemeier Hansson <[email protected]>
- Loading branch information
1 parent
539b249
commit 8266575
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters