Closed Bug 965897 Opened 10 years ago Closed 10 years ago

Make nsHTMLReflowState verify its "aPresContext Must be equal to aFrame->PresContext()" precondition

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(1 file)

nsHTMLReflowState has this documentation on its constructor and its ::Init method:
> 468    * @param aPresContext Must be equal to aFrame->PresContext().
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsHTMLReflowState.h#468
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsHTMLReflowState.h#486

But we don't actually verify that anywhere, aside from a NS_PRECONDITION that checks that it's non-null.

Might as well add an explicit NS_PRECONDITION to enforce that documentation.
Sorry, by "on its constructor and its ::Init method" I meant "on its constructors".
Attached patch fixSplinter Review
Attachment #8368072 - Flags: review?(matspal)
Sanity-check try run, to be sure we don't violate this (at least, not in crashtests/reftests):
 https://tbpl.mozilla.org/?tree=Try&rev=622c501e0070
Comment on attachment 8368072 [details] [diff] [review]
fix

This is such a fundamental precondition that it should use MOZ_ASSERT.
r=mats with that.

The null-checks before it could also use MOZ_ASSERT but I suspect you
wouldn't get very far anyway :-)
Attachment #8368072 - Flags: review?(matspal) → review+
(In reply to Mats Palmgren (:mats) from comment #4)
> The null-checks before it could also use MOZ_ASSERT but I suspect you
> wouldn't get very far anyway :-)

I took the liberty of converting the aFrame and aPresContext null-checks to be MOZ_ASSERTS, because we literally wouldn't be able to make it past my new MOZ_ASSERT if either of those values were null.

Landed, with that change:
  https://hg.mozilla.org/integration/mozilla-inbound/rev/84b6f0aba30d
Flags: in-testsuite-
https://hg.mozilla.org/mozilla-central/rev/84b6f0aba30d
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: