iOS icon indicating copy to clipboard operation
iOS copied to clipboard

Hung page detection

Open mallexxx opened this issue 3 years ago • 3 comments

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:

  1. Create a local page (put it into /Library/WebServer/Documents) with a JS script while (true) alert("tada!"); or while (true) ;
  2. Navigate to your machine IP address, dismiss couple of alerts
  3. 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
  4. Validate the hanging detection implementation doesn‘t break other (normal) navigations flows
  5. Hang the page, hit Reload and switch to another tab
  6. 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

mallexxx avatar Sep 14 '22 08:09 mallexxx

@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

mallexxx avatar Sep 20 '22 08:09 mallexxx

TODO: make it explicit in DEBUG

mallexxx avatar Oct 14 '22 13:10 mallexxx

@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

mallexxx avatar Oct 17 '22 10:10 mallexxx