Bug 16808 - ASSERT(m_document->frame() == m_view->frame()) failing in CachedPage::clear when running Safari's PLT
Summary: ASSERT(m_document->frame() == m_view->frame()) failing in CachedPage::clear w...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Frames (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Adam Roben (:aroben)
URL:
Keywords: InRadar
Depends on:
Blocks: 16607
  Show dependency treegraph
 
Reported: 2008-01-09 15:50 PST by Adam Roben (:aroben)
Modified: 2008-01-10 13:25 PST (History)
5 users (show)

See Also:


Attachments
patch in progress (5.64 KB, patch)
2008-01-09 15:52 PST, Adam Roben (:aroben)
no flags Details | Formatted Diff | Diff
patch v2 (11.45 KB, patch)
2008-01-10 12:45 PST, Adam Roben (:aroben)
hyatt: review+
Details | Formatted Diff | Diff
patch v3 (12.30 KB, patch)
2008-01-10 13:09 PST, Adam Roben (:aroben)
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2008-01-09 15:50:04 PST
ASSERT(m_document->frame() == m_view->frame()) in CachedPage::clear fails when running Safari's PLT. I believe this is due to Windows WebKit keeping FrameViews around for longer than Mac WebKit. Windows WebKit currently creates one FrameView per Frame, while Mac WebKit creates a new FrameView for each new page load in each Frame.
Comment 1 Adam Roben (:aroben) 2008-01-09 15:52:17 PST
Created attachment 18355 [details]
patch in progress

Here's a patch in progress. However, I'm hitting the assertions in FrameView::scheduleRelayout due to FrameViews in the page cache having layout scheduled for them.
Comment 2 Adam Roben (:aroben) 2008-01-09 15:54:51 PST
<rdar://5659200&5659355>
Comment 3 Adam Roben (:aroben) 2008-01-09 16:01:00 PST
See bug 13913 and bug 14794 for similar issues with the GTK port
Comment 4 Kevin McCullough 2008-01-09 16:49:28 PST
Comment on attachment 18355 [details]
patch in progress

Most of this patch looks good to me, although I'm not sure I know enough to give it an r+.

Also you said to remind you to double check if it's ok to remove the call to resetMultipleFormSubmissionProtection()
Comment 5 Kevin McCullough 2008-01-09 17:05:59 PST
Comment on attachment 18355 [details]
patch in progress

I hit the assert:  ASSERT(!m_frame->document() || !m_frame->document()->inPageCache());
Every time I navigate.  Are you not having this issue?
Comment 6 mitz 2008-01-09 19:47:26 PST
Comment on attachment 18355 [details]
patch in progress

 1856         frameView->attachToWindow();

I expect attachToWindow() to happen as a result of calling setWidget(). Does it not?
Comment 7 Adam Roben (:aroben) 2008-01-10 07:09:23 PST
(In reply to comment #4)
> (From update of attachment 18355 [details] [edit])
> Most of this patch looks good to me, although I'm not sure I know enough to
> give it an r+.
> 
> Also you said to remind you to double check if it's ok to remove the call to
> resetMultipleFormSubmissionProtection()

I remember now that I removed it from transitionToCommittedFromCachedPage because the Mac doesn't call it there, either.
Comment 8 Adam Roben (:aroben) 2008-01-10 07:09:49 PST
(In reply to comment #5)
> (From update of attachment 18355 [details] [edit])
> I hit the assert:  ASSERT(!m_frame->document() ||
> !m_frame->document()->inPageCache());
> Every time I navigate.  Are you not having this issue?

I am having that issue, as I said when I uploaded the patch (see comment #2).
Comment 9 Adam Roben (:aroben) 2008-01-10 08:52:18 PST
(In reply to comment #6)
> (From update of attachment 18355 [details] [edit])
>  1856         frameView->attachToWindow();
> 
> I expect attachToWindow() to happen as a result of calling setWidget(). Does it
> not?

Hm, I suppose it does: RenderPart::setWidget -> RenderWidget::setWidget -> ScrollView::addChild -> Widget::setParent -> Widget::attachToWindow. Thanks for pointing that out!
Comment 10 Adam Roben (:aroben) 2008-01-10 08:57:15 PST
(In reply to comment #9)
> (In reply to comment #6)
> > (From update of attachment 18355 [details] [edit] [edit])
> >  1856         frameView->attachToWindow();
> > 
> > I expect attachToWindow() to happen as a result of calling setWidget(). Does it
> > not?
> 
> Hm, I suppose it does: RenderPart::setWidget -> RenderWidget::setWidget ->
> ScrollView::addChild -> Widget::setParent -> Widget::attachToWindow. Thanks for
> pointing that out!

Ah, but we only call attachToWindow() on the main frame, and we only call setWidget() on frames that have an ownerRenderer(), so I think both calls need to remain.
Comment 11 mitz 2008-01-10 09:55:32 PST
(In reply to comment #10)
> Ah, but we only call attachToWindow() on the main frame, and we only call
> setWidget() on frames that have an ownerRenderer(), so I think both calls need
> to remain.

Oh, that's right. Sorry. The reason the attachToWindow() drew my attention was that I did not see a detachFromWindow() to balance it. So now the question is, should you call detachFromWindow() on the frame's current view before calling frame->setView(0)?
Comment 12 Adam Roben (:aroben) 2008-01-10 12:45:28 PST
Created attachment 18371 [details]
patch v2

With this patch I no longer hit assertions when browsing, running the PLT, or running the regression tests with the back/forward cache turned on.
Comment 13 Dave Hyatt 2008-01-10 12:55:01 PST
Comment on attachment 18371 [details]
patch v2

Make setWidget explicitly remove the widget rather than patching WidgetWin's destructor.  This way you do the removal in a cross-platform way and don't have to patch the other platforms' widget classes.
Comment 14 Adam Roben (:aroben) 2008-01-10 13:09:39 PST
Created attachment 18373 [details]
patch v3

Incorporates hyatt's comments (which actually were already implemented by a patch for bug 16456).
Comment 15 Dave Hyatt 2008-01-10 13:13:09 PST
Comment on attachment 18373 [details]
patch v3

r=me

I think it's worth explicitly mentioning in a comment that removeFromParent() is a no-op on Mac (next to the call site).
Comment 16 Adam Roben (:aroben) 2008-01-10 13:25:08 PST
(In reply to comment #15)
> (From update of attachment 18373 [details] [edit])
> r=me
> 
> I think it's worth explicitly mentioning in a comment that removeFromParent()
> is a no-op on Mac (next to the call site).

Done and landed as r29369.