Bug 53648

Summary: REGRESSION (r77355): Page cache layout tests crash
Product: WebKit Reporter: Mihai Parparita <mihaip>
Component: DOMAssignee: Mihai Parparita <mihaip>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, aroben, beidson, dimich, eric, fishd, jamesr, jorlow, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 53667    
Attachments:
Description Flags
Patch ap: review+

Mihai Parparita
Reported 2011-02-02 17:05:20 PST
fast/events/pageshow-pagehide-on-back-cached.html and fast/history/timed-refresh-in-cached-frame.html crash after r77355 with this assert: ASSERTION FAILED: !m_suspended (/Volumes/Data/WebKit-BuildSlave/snowleopard-intel-leaks/build/Source/WebCore/page/SuspendableTimer.cpp:62 virtual void WebCore::SuspendableTimer::suspend(WebCore::ActiveDOMObject::ReasonForSuspension))
Attachments
Patch (8.00 KB, patch)
2011-02-03 14:13 PST, Mihai Parparita
ap: review+
Mihai Parparita
Comment 1 2011-02-02 19:03:37 PST
+Alexey for ActiveDOMObject +Brady for page cache +Jeremy for IndexedDB since it's also looking to use ActiveDOMObject +James since we just talked about this +Dmitry since he asked about this bug in #webkit This assert happens because those test show an alert in a pagehide handler. In CachedFrame::CachedFrame (http://trac.webkit.org/browser/trunk/Source/WebCore/history/CachedFrame.cpp#L125) we first suspend ActiveDOMObjects (line 139) and then invoke pagehide handlers (line 148). Therefore the SuspendableTimer that's associated with the EventQueue is suspended once by CachedFrame and then again when the modal dialog is shown. This problem existed before r77355, it's just that it was harder to trigger before (now there's a SuspendableTimer associated with every Document). Here's another way in which it gets triggered: http://persistent.info/webkit/test-cases/webkit-53648/timeout-pagehide-alert.html (that creates a DOMTimer (which subclasses SuspendableTimer) via setTimeout, and then navigates away and shows an alert in the pagehide handler). I also would have expected this to happen when nesting modal dialogs (by having showModalDialog call alert), but that doesn't seem to happen (tests in http://persistent.info/webkit/test-cases/webkit-53648/nested-dialogs.html and http://persistent.info/webkit/test-cases/webkit-53648/nested-dialogs-2.html). There's a few ways of fixing this: 1. Re-order the suspendActiveDOMObjects and stopLoading calls in CachedFrame. Brady, is there a reason why we suspend active DOM objects before triggering more JS execution? 2. Handle this nesting at the SuspendableTimer level. However, other ActiveDOMObject subclasses may be suspendable to this problem too. 3. Handle this nesting at the ActiveDOMObject or ScriptExecutionContext level, so that all classes get sane default nesting behavior. However, some ActiveDOMObjects (e.g. HTMLMediaElement) don't actually suspend/resume in some cases (e.g. for modal dialogs) so they may not want this.
Alexey Proskuryakov
Comment 2 2011-02-02 19:21:32 PST
> we first suspend ActiveDOMObjects (line 139) and then invoke pagehide handlers (line 148). This sounds pretty terrible - it means that active objects added by pagehide handlers won't be suspended, right?
James Robinson
Comment 3 2011-02-02 19:23:28 PST
(In reply to comment #2) > > we first suspend ActiveDOMObjects (line 139) and then invoke pagehide handlers (line 148). > > This sounds pretty terrible - it means that active objects added by pagehide handlers won't be suspended, right? Yeah that does sound bad - sounds like we should probably do the suspend-for-inactive call _after_ firing pagehide.
Mihai Parparita
Comment 4 2011-02-03 10:42:04 PST
(In reply to comment #2) > > we first suspend ActiveDOMObjects (line 139) and then invoke pagehide handlers (line 148). > > This sounds pretty terrible - it means that active objects added by pagehide handlers won't be suspended, right? Yes, see test case at http://persistent.info/webkit/test-cases/webkit-53648/timeout-pagehide.html (the alert that fires was created by the previous page by setting a timeout in the pagehide handler). I'll try re-ordering the calls in CachedFrame and see if anything breaks.
Mihai Parparita
Comment 5 2011-02-03 14:13:32 PST
Mihai Parparita
Comment 6 2011-02-03 14:15:17 PST
(In reply to comment #4) > I'll try re-ordering the calls in CachedFrame and see if anything breaks. Nothing broke, except for bug 53716 (which is a coincidence, since the patch adds a test that causes recorded-keydown-event.html and tabindex-focus-blur-all.html in fast/events to get run in the same DRT session).
Adam Roben (:aroben)
Comment 7 2011-02-03 16:05:09 PST
Alexey Proskuryakov
Comment 8 2011-02-03 16:22:13 PST
Comment on attachment 81113 [details] Patch This seems fine, but doesn't fix a more general case with multiple frames calling into each other from pagehide.
Mihai Parparita
Comment 9 2011-02-03 16:35:50 PST
(In reply to comment #8) > (From update of attachment 81113 [details]) > This seems fine, but doesn't fix a more general case with multiple frames calling into each other from pagehide. Filed bug 53733 about this.
Mihai Parparita
Comment 10 2011-02-03 16:40:32 PST
WebKit Review Bot
Comment 11 2011-02-04 02:40:39 PST
http://trac.webkit.org/changeset/77559 might have broken GTK Linux 32-bit Release, GTK Linux 32-bit Debug, and GTK Linux 64-bit Debug The following tests are not passing: fast/events/pagehide-timeout.html
Mihai Parparita
Comment 12 2011-02-04 08:50:25 PST
(In reply to comment #11) > http://trac.webkit.org/changeset/77559 might have broken GTK Linux 32-bit Release, GTK Linux 32-bit Debug, and GTK Linux 64-bit Debug > The following tests are not passing: > fast/events/pagehide-timeout.html Filed bug 53771 about this.
Note You need to log in before you can comment on or make changes to this bug.