applied bug1362924.diff

This commit is contained in:
2018-07-12 13:41:19 +08:00
parent 066025ab7a
commit b4f94837b6
2 changed files with 86 additions and 32 deletions
+24 -16
View File
@@ -1822,6 +1822,24 @@ PresShell::EndObservingDocument()
char* nsPresShell_ReflowStackPointerTop;
#endif
class XBLConstructorRunner : public nsRunnable
{
public:
explicit XBLConstructorRunner(nsIDocument* aDocument)
: mDocument(aDocument)
{
}
NS_IMETHOD Run() override
{
mDocument->BindingManager()->ProcessAttachedQueue();
return NS_OK;
}
private:
nsCOMPtr<nsIDocument> mDocument;
};
nsresult
PresShell::Initialize(nscoord aWidth, nscoord aHeight)
{
@@ -1919,24 +1937,14 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
mFrameConstructor->EndUpdate();
}
// nsAutoScriptBlocker going out of scope may have killed us too
// nsAutoCauseReflowNotifier (which sets up a script blocker) going out of
// scope may have killed us too
NS_ENSURE_STATE(!mHaveShutDown);
// Run the XBL binding constructors for any new frames we've constructed
mDocument->BindingManager()->ProcessAttachedQueue();
// Constructors may have killed us too
NS_ENSURE_STATE(!mHaveShutDown);
// Now flush out pending restyles before we actually reflow, in
// case XBL constructors changed styles somewhere.
{
nsAutoScriptBlocker scriptBlocker;
mPresContext->RestyleManager()->ProcessPendingRestyles();
}
// And that might have run _more_ XBL constructors
NS_ENSURE_STATE(!mHaveShutDown);
// Run the XBL binding constructors for any new frames we've constructed.
// (Do this in a script runner, since our caller might have a script
// blocker on the stack.)
nsContentUtils::AddScriptRunner(new XBLConstructorRunner(mDocument));
}
NS_ASSERTION(rootFrame, "How did that happen?");