Variations on bug 429865's crashtest still cause problems.
Created attachment 417591 [details]
testcase 1 (aborts)
###!!! ASSERTION: prev sibling not in line list: 'Not Reached', file layout/generic/nsBlockFrame.cpp, line 4764
###!!! ASSERTION: aFrame is not a descendent of aBlockFrame: 'parent', file layout/base/nsBidiPresUtils.cpp, line 285
###!!! ASSERTION: Can't find frame in lines!: 'hasNext', file layout/base/nsBidiPresUtils.cpp, line 291
###!!! ABORT: comparing iterators over different lists: 'mListLink == aOther.mListLink', file layout/base/../generic/nsLineBox.h, line 704
Created attachment 417592 [details]
testcase 2 (crashes)
###!!! ASSERTION: Should have been cleared: 'mBreakSinks.IsEmpty()', file layout/generic/nsTextFrameThebes.cpp, line 649
###!!! ASSERTION: invalid array index: 'i < Length()', file ../../dist/include/nsTArray.h, line 317
Crash [@ nsBidiPresUtils::Resolve] accessing 0x55555555 (with MallocScribble)
Looking at the first testcase, stripping out all the dynamic stuff, a text frame continuation stays on the firstletter frame's overflow list because of the code here http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsFirstLetterFrame.cpp#205 where we invent a linelayout from nothing, and SetDirtyNextLine gets called on that linelayout, nothing ever comes of the SetDirtyNextLine call because we forget about that linelayout right away.
As a side note, can we assert that nothing is on overflow lists after a flush and/or when entering frame construction (anywhere else?)? I've seen a few Jesse bugs that would have probably been found much quicker if we asserted such.
When we invent a linelayout from nothing, we have to not wrap anything on the line.
Yes, we could assert that nothing is on overflow lists, apart from the above issue which I'm not sure how to fix. But in the past we've tried to survive having content left on overflow lists. Probably we should try to survive it still.
The SetDirtyNextLine was just a symptom of the real problem, we weren't trying to wrap to another line, the first letter logic was causing the continuation to be created.
I think what we need is to do the same thing as bug 491547 but in nsFirstLetterFrame::Reflow in the case where we create a next-in-flow for a child of a floating letter frame. Normally we'd create a continuation for the textframe child of a floating first letter frame if it might need one ahead of time in nsCSSFrameConstructor::CreateFloatingLetterFrame. But that doesn't correctly detect that this situation needs a continuation, and I don't think in general that it could easily be adapted to be able to handle other dynamic situations.
Created attachment 417662 [details] [diff] [review]
Hopefully this situation only happens on BIDI frames so that we can use nextBidi to insert the continuation where we need to without triggering a reflow command.
Simon, do you want to review this or are you fine with just roc reviewing?
Comment on attachment 417662 [details] [diff] [review]
Apologies for the delay
I remembered that I wanted to look into this more. Turns out you don't need any BIDI to trigger the condition of needing to create a continuation for a textframe inside a floating first-letter frame. A block with floating first-letter style that contains only a space followed by a character that is not punctuation, not a space, and not alphanumeric will do it. So the "should only get here with bidi frames" assertion will fire.
We need to use the nextBidi listname when inserting the continuation so that we don't try to issue a another reflow from inside a reflow. So I propose removing the assertion and making it clear in a comment that the listname nextBidi is bogus but necessary.
Sounds good to me. Please do that and let's get this fixed!
Made those changes and landed
Can we get a crashtest, as well as branch patches worked up?
What do you mean by "get a crashtest"? For security bugs the procedure I've been using is to set "in-testsuite?", and then when the bug is opened the testcase can be landed. Is there a better way I should be handling it?
Created attachment 434362 [details] [diff] [review]
Enough changes that I liked a second set of eyes on this.
The extra queryframe stuff is needed because nsIFrame and nsIFrameDebug (gone on m-c) make it ambiguous otherwise.
Created attachment 434363 [details] [diff] [review]
(In reply to comment #13)
> What do you mean by "get a crashtest"? For security bugs the procedure I've
> been using is to set "in-testsuite?", and then when the bug is opened the
> testcase can be landed. Is there a better way I should be handling it?
Not landing the test and using "in-testsuite?" is great, that's what we want for security bugs. However, we do like to have the test in hand, both so your reviewer can review it (does it have sufficient coverage, etc) and so QA can manually apply it to their trees and test with it.
Comment on attachment 434362 [details] [diff] [review]
Approved for 220.127.116.11, a=dveditz for release-drivers
Comment on attachment 434363 [details] [diff] [review]
Approved for 18.104.22.168, a=dveditz for release-drivers
In this case the test is just the two testcases in this bug imported into the tree as crashtests. So the reviewer can see them and QA can load them directly without needing to apply anything.
Verified for 1.9.2 using the two attached tests. Aborts and crashes (respectively) on 22.214.171.124 but has no problems with my build from today (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:126.96.36.199pre) Gecko/20100407 Lorentz/3.6.4pre (.NET CLR 3.5.30729)).
Verified for 1.9.1 the same way with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:188.8.131.52pre) Gecko/20100407 Shiretoko/3.5.10pre (.NET CLR 3.5.30729).