bug 1249664 - Assert when additions to LayoutHistoryState overwrite. r?dbaron draft
authorChris H-C <chutten@mozilla.com>
Tue, 08 Mar 2016 15:49:42 -0500
changeset 339217 142439e719f66318cdaa8b9604dcbc87273d40a1
parent 339216 60a301442ce4950b8b1711754f63190f6e134828
child 515934 315e8e48f312330e5cee5d1535e50d57e8f3a4f0
push id12666
push userbmo:chutten@mozilla.com
push dateThu, 10 Mar 2016 19:31:56 +0000
reviewersdbaron
bugs1249664
milestone47.0a1
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
layout/base/nsLayoutHistoryState.cpp
--- 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);