Bug 1555645 - Make PresShell::EventHandler::MaybeFlushThrottledStyles() stop handling it when the PresShell does not have root PreShell nor Document r=smaug

The crash reports just tell us that the crash occur due to referring around
address 0 in `PresShell::EventHandler::MaybeFlushThrottledStyles()`.
Therefore, I'm not sure which is the actual reason of the crashes though,
this patch makes it null-check root `PresShell` and its `Document` before
accessing the latter.

Differential Revision: https://phabricator.services.mozilla.com/D33735
This commit is contained in:
Masayuki Nakano
2019-06-05 09:28:53 +00:00
parent 9f5946ffb4
commit a59dba2251

View File

@@ -7318,11 +7318,19 @@ nsIFrame* PresShell::EventHandler::MaybeFlushThrottledStyles(
return aFrameForPresShell;
}
PresShell* rootPresShell = mPresShell->GetRootPresShell();
if (NS_WARN_IF(!rootPresShell)) {
return nullptr;
}
Document* rootDocument = rootPresShell->GetDocument();
if (NS_WARN_IF(!rootDocument)) {
return nullptr;
}
AutoWeakFrame weakFrameForPresShell(aFrameForPresShell);
{ // scope for scriptBlocker.
nsAutoScriptBlocker scriptBlocker;
FlushThrottledStyles(mPresShell->GetRootPresShell()->GetDocument(),
nullptr);
FlushThrottledStyles(rootDocument, nullptr);
}
if (weakFrameForPresShell.IsAlive()) {