mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
Bug 1841464 - Make ContentCacheInChild
return false
from caching content methods if it creates invalid data r=m_kato
Once `PuppetWidget` sends invalid data, the parent process will return error and that makes the sender content process crashed. Therefore, if we detect that we created invalid data, we should not send the invalid data to avoid the crash. Differential Revision: https://phabricator.services.mozilla.com/D182652
This commit is contained in:
parent
3986073957
commit
32d56f7185
@ -149,7 +149,7 @@ bool ContentCacheInChild::CacheAll(nsIWidget* aWidget,
|
||||
const bool textCached = CacheText(aWidget, aNotification);
|
||||
const bool editorRectCached = CacheEditorRect(aWidget, aNotification);
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsValid());
|
||||
return textCached || editorRectCached;
|
||||
return (textCached || editorRectCached) && IsValid();
|
||||
}
|
||||
|
||||
bool ContentCacheInChild::CacheSelection(nsIWidget* aWidget,
|
||||
@ -196,8 +196,9 @@ bool ContentCacheInChild::CacheSelection(nsIWidget* aWidget,
|
||||
mSelection.emplace(querySelectedTextEvent);
|
||||
}
|
||||
|
||||
return CacheCaretAndTextRects(aWidget, aNotification) ||
|
||||
querySelectedTextEvent.Succeeded();
|
||||
return (CacheCaretAndTextRects(aWidget, aNotification) ||
|
||||
querySelectedTextEvent.Succeeded()) &&
|
||||
IsValid();
|
||||
}
|
||||
|
||||
bool ContentCacheInChild::CacheCaret(nsIWidget* aWidget,
|
||||
@ -233,7 +234,7 @@ bool ContentCacheInChild::CacheCaret(nsIWidget* aWidget,
|
||||
("0x%p CacheCaret(), Succeeded, mSelection=%s, mCaret=%s", this,
|
||||
ToString(mSelection).c_str(), ToString(mCaret).c_str()));
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsValid());
|
||||
return true;
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
bool ContentCacheInChild::CacheEditorRect(
|
||||
@ -278,7 +279,7 @@ bool ContentCacheInChild::CacheCaretAndTextRects(
|
||||
const bool caretCached = CacheCaret(aWidget, aNotification);
|
||||
const bool textRectsCached = CacheTextRects(aWidget, aNotification);
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsValid());
|
||||
return caretCached || textRectsCached;
|
||||
return (caretCached || textRectsCached) && IsValid();
|
||||
}
|
||||
|
||||
bool ContentCacheInChild::CacheText(nsIWidget* aWidget,
|
||||
@ -615,7 +616,7 @@ bool ContentCacheInChild::CacheTextRects(nsIWidget* aWidget,
|
||||
ToString(mFirstCharRect).c_str(),
|
||||
ToString(mLastCommitStringTextRectArray).c_str()));
|
||||
MOZ_DIAGNOSTIC_ASSERT(IsValid());
|
||||
return true;
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
bool ContentCacheInChild::SetSelection(
|
||||
@ -650,7 +651,7 @@ bool ContentCacheInChild::SetSelection(
|
||||
CacheCaret(aWidget);
|
||||
CacheTextRects(aWidget);
|
||||
|
||||
return mSelection.isSome();
|
||||
return mSelection.isSome() && IsValid();
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user