Closed Bug 300538 Opened 20 years ago Closed 20 years ago

[FIXr]Asserts on subframe navigation with bfcache

Categories

(Core :: DOM: Navigation, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta4

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

()

Details

Attachments

(1 file, 1 obsolete file)

STEPS TO REPRODUCE: Load testcase in URL bar and follow directions ACTUAL RESULTS: ###!!! ASSERTION: error in InsertChild: 'newRootView->GetNextSibling() == rootViewSibling', file ../../../mozilla/docshell/base/nsDocShell.cpp, line 5255 EXPECTED RESULTS: no asserts I suspect the problem here is that we're passing PR_TRUE for the aAfter parameter to InsertChild, but since the sibling we're passing is the old nextSibling, we want to pass PR_FALSE...
Attached patch This does seem to fix it... (obsolete) — Splinter Review
Attachment #189121 - Flags: superreview?(bryner)
Attachment #189121 - Flags: review?(bryner)
Comment on attachment 189121 [details] [diff] [review] This does seem to fix it... I don't think this is right. rootViewSibling is what we want the _next_ sibling of newRootView to be. The aAfter parameter of InsertChild refers to the document order, so passing true means that the view will be inserted _before_ rootViewSibling, which is what we want. The naming gets a little confusing, so please double-check me on that. At this point, though, I'm guessing the assertion is caused by something else...
Attachment #189121 - Flags: superreview?(bryner)
Attachment #189121 - Flags: superreview-
Attachment #189121 - Flags: review?(bryner)
Attachment #189121 - Flags: review-
Hmm... roc, are views stored in document order, or reversed? The comment on nsIView::GetFirstChild indicates the former, while the comments in nsViewManager::InsertChild indicate the latter. In any case, the case we're looking at here (in that testcase) is that rootViewSibling is null. So we'll hit the following code in nsViewManager: 2649 if (nsnull == aSibling) { 2650 if (aAfter) { 2651 // insert at end of document order, i.e., before first view 2652 // this is the common case, by far 2653 parent->InsertChild(child, nsnull); This inserts |child| as the mFirstChild of |parent|; if |parent| had any children, then child->GetNextSibling() will be non-null after this call, which is what triggers our assert. Perhaps the assert itself is what's wrong? If views are stored in reverse order, then I'd expect that rootViewSibling->GetNextSibling() would be the new root view...
(In reply to comment #3) > Hmm... roc, are views stored in document order, or reversed? Reversed. > The comment on > nsIView::GetFirstChild indicates the former, while the comments in > nsViewManager::InsertChild indicate the latter. In any case, the case we're > looking at here (in that testcase) is that rootViewSibling is null. So we'll > hit the following code in nsViewManager: > > 2649 if (nsnull == aSibling) { > 2650 if (aAfter) { > 2651 // insert at end of document order, i.e., before first view > 2652 // this is the common case, by far > 2653 parent->InsertChild(child, nsnull); > > This inserts |child| as the mFirstChild of |parent|; if |parent| had any > children, then child->GetNextSibling() will be non-null after this call, which > is what triggers our assert. InsertChild(.., child, sib, PR_TRUE) inserts the child after sib in content order, which is before sib in view order. BUT when sib is null it inserts at the end of the the document order, i.e., first in view order. So I think when oldRootSibling is null, the old root as at the end of the view list --- last in content order --- and you want to call InsertChild(.., child, nsnull, PR_FALSE) in that case. Sorry that this API is a broken. > Perhaps the assert itself is what's wrong? If views are stored in reverse > order, then I'd expect that rootViewSibling->GetNextSibling() would be the new > root view...
Attachment #189121 - Attachment is obsolete: true
Attachment #189143 - Flags: superreview?(roc)
Attachment #189143 - Flags: review?(bryner)
Attachment #189143 - Flags: superreview?(roc) → superreview+
Attachment #189143 - Flags: review?(bryner) → review+
Comment on attachment 189143 [details] [diff] [review] Patch per roc's explanation Requesting approval for 1.8b4.
Attachment #189143 - Flags: approval1.8b4?
Assignee: bryner → bzbarsky
Priority: -- → P1
Summary: Asserts on subframe navigation with bfcache → [FIXr]Asserts on subframe navigation with bfcache
Target Milestone: --- → mozilla1.8beta4
Attachment #189143 - Flags: approval1.8b4? → approval1.8b4+
Fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: