bug 1249664 - Assert when additions to LayoutHistoryState overwrite. r?dbaron
If multiple stateful frames are representing the same element on the same
document, they will have the same stateKey and will overwrite each others'
states in LayoutHistoryState. This is not intended behaviour, so an assert
would be prudent.
MozReview-Commit-ID: 8siNFRBQ9jx
--- a/layout/base/nsLayoutHistoryState.cpp
+++ b/layout/base/nsLayoutHistoryState.cpp
@@ -56,16 +56,17 @@ NS_NewLayoutHistoryState()
NS_IMPL_ISUPPORTS(nsLayoutHistoryState,
nsILayoutHistoryState,
nsISupportsWeakReference)
void
nsLayoutHistoryState::AddState(const nsCString& aStateKey, nsPresState* aState)
{
+ MOZ_ASSERT(!mStates.Contains(aStateKey));
mStates.Put(aStateKey, aState);
}
nsPresState*
nsLayoutHistoryState::GetState(const nsCString& aKey)
{
nsPresState* state = nullptr;
bool entryExists = mStates.Get(aKey, &state);