Destroy frame properties right after destroying the frame tree so they're destroyed before the style set. (Bug 399994) r=roc

This commit is contained in:
L. David Baron 2009-07-23 07:40:18 -04:00
parent e1b3b43cd4
commit db8021d58c
3 changed files with 25 additions and 7 deletions

View File

@ -0,0 +1,11 @@
<html class="reftest-print">
<head>
</head>
<body>
<div style="display: table; position: fixed;">
<div style="display: table-row; page-break-after: always;"></div>
<div style="display: table-row;"></div>
</div>
</body>
</html>

View File

@ -171,6 +171,7 @@ load 399687-1.html
load 399940-1.xhtml
load 399946-1.xhtml
load 399951-1.html
load 399994-1.html
load 400185-1.xul
load 400445-1.xhtml
load 400904-1.xhtml

View File

@ -2036,6 +2036,19 @@ PresShell::Destroy()
mFrameConstructor->WillDestroyFrameTree();
FrameManager()->Destroy();
// Destroy all frame properties (whose destruction was suppressed
// while destroying the frame tree, but which might contain more
// frames within the properties.
if (mPresContext) {
// Clear out the prescontext's property table -- since our frame tree is
// now dead, we shouldn't be looking up any more properties in that table.
// We want to do this before we call SetShell() on the prescontext, so
// property destructors can usefully call GetPresShell() on the
// prescontext.
mPresContext->PropertyTable()->DeleteAllProperties();
}
NS_WARN_IF_FALSE(!mWeakFrames, "Weak frames alive after destroying FrameManager");
while (mWeakFrames) {
mWeakFrames->Clear(this);
@ -2045,13 +2058,6 @@ PresShell::Destroy()
mStyleSet->Shutdown(mPresContext);
if (mPresContext) {
// Clear out the prescontext's property table -- since our frame tree is
// now dead, we shouldn't be looking up any more properties in that table.
// We want to do this before we call SetShell() on the prescontext, so
// property destructors can usefully call GetPresShell() on the
// prescontext.
mPresContext->PropertyTable()->DeleteAllProperties();
// We hold a reference to the pres context, and it holds a weak link back
// to us. To avoid the pres context having a dangling reference, set its
// pres shell to NULL