Bug 1792555 - key and val arguments to NoteWeakMapping() method can't be null. r=kmag

Add some assertions and drop useless null checks to reflect this.

Differential Revision: https://phabricator.services.mozilla.com/D158202
This commit is contained in:
Andrew McCreight 2022-10-10 14:46:16 +00:00
parent b02ecf7bf2
commit dbb83041d9

View file

@ -2251,12 +2251,14 @@ CCGraphBuilder::NoteWeakMapping(JSObject* aMap, JS::GCCellPtr aKey,
NS_IMETHODIMP_(void)
CCGraphBuilder::NoteWeakMapping(JSObject* aKey, nsISupports* aVal,
nsCycleCollectionParticipant* aValParticipant) {
MOZ_ASSERT(aKey, "Don't call NoteWeakMapping with a null key");
MOZ_ASSERT(aVal, "Don't call NoteWeakMapping with a null value");
WeakMapping* mapping = mGraph.mWeakMaps.AppendElement();
mapping->mMap = nullptr;
mapping->mKey = aKey ? AddWeakMapNode(aKey) : nullptr;
mapping->mKey = AddWeakMapNode(aKey);
mapping->mKeyDelegate = mapping->mKey;
MOZ_ASSERT(js::UncheckedUnwrapWithoutExpose(aKey) == aKey);
mapping->mVal = aVal ? AddNode(aVal, aValParticipant) : nullptr;
mapping->mVal = AddNode(aVal, aValParticipant);
if (mLogger) {
mLogger->NoteWeakMapEntry(0, (uint64_t)aKey, 0, (uint64_t)aVal);