Bug 1209124 - Bail out of nsStyleSet::GatherRuleProcessors and PresShell::Observe if we're called during/after shutdown. r=dbaron

This commit is contained in:
Cameron McCormack 2015-09-29 12:16:04 +10:00
parent 132b75b223
commit 8a56a13543
2 changed files with 7 additions and 0 deletions

View File

@ -9391,6 +9391,11 @@ PresShell::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
if (mIsDestroying) {
NS_WARNING("our observers should have been unregistered by now");
return NS_OK;
}
#ifdef MOZ_XUL
if (!nsCRT::strcmp(aTopic, "chrome-flush-skin-caches")) {
nsIFrame *rootFrame = mFrameConstructor->GetRootFrame();

View File

@ -389,6 +389,8 @@ SortStyleSheetsByScope(nsTArray<CSSStyleSheet*>& aSheets)
nsresult
nsStyleSet::GatherRuleProcessors(sheetType aType)
{
NS_ENSURE_FALSE(mInShutdown, NS_ERROR_FAILURE);
// We might be in GatherRuleProcessors because we are dropping a sheet,
// resulting in an nsCSSSelector being destroyed. Tell the
// RestyleManager for each document we're used in so that they can