Hung page detection
Task/Issue URL: (please insert Asana task about hung js alerts here) Tech Design URL: CC: @Bunn @miasma13
Description: This PR fixes cyclic alerts/hung JS problem causing the whole Tab‘s navigation to stop responding
Steps to test this PR:
- Create a local page (put it into /Library/WebServer/Documents) with a JS script
while (true) alert("tada!");orwhile (true) ; - Navigate to your machine IP address, dismiss couple of alerts
- Validate navigation back/forward/to a back/forward list item/refresh/navigation to a URL takes you away from the page and alerts are suppressed until the next visit
- Validate the hanging detection implementation doesn‘t break other (normal) navigations flows
- Hang the page, hit Reload and switch to another tab
- Hang the page, tap the page several times and hit Reload
Device Testing:
- [ ] iPhone
- [ ] iPad
OS Testing:
- [x] iOS 14
- [x] iOS 15
Internal references:
Software Engineering Expectations Technical Design Template When ready for review, remember to post the PR in MM
@bwaresiak this should be ready for another pass now; I‘ve made the changes you requested and added instant recreation on recursive alerts detection and multiple navigation requests Opened test pages PR: https://github.com/duckduckgo/privacy-test-pages/pull/101
In fact there is _webViewWebProcessDidBecomeUnresponsive: NavigationDelegate method which is called by a private Responsiveness timer (basically the same as the navigationExpectationTimer) but it‘s invalidated on any page tap made by a user so our implementation should be better
TODO: make it explicit in DEBUG
@bwaresiak as discussed, I've added DEBUG log instructions on how to disable the termination behaviour and a breakpoint to make sure it gets noticed