From 27932e0385f39b69e62fd4a1ab81162725059644 Mon Sep 17 00:00:00 2001 From: Jan Varga Date: Tue, 31 Jul 2018 12:27:17 +0200 Subject: [PATCH] Bug 1478573; r=asuth --- dom/indexedDB/IDBObjectStore.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index ea17b6bacd66..80ff62056c89 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -1941,10 +1941,16 @@ IDBObjectStore::GetAddInfo(JSContext* aCx, // Figure out indexes and the index values to update here. const nsTArray& indexes = mSpec->indexes(); - const uint32_t idxCount = indexes.Length(); + uint32_t idxCount = indexes.Length(); - if (idxCount && !aValueWrapper.Clone(aCx)) { - return NS_ERROR_DOM_DATA_CLONE_ERR; + if (idxCount) { + if (!aValueWrapper.Clone(aCx)) { + return NS_ERROR_DOM_DATA_CLONE_ERR; + } + + // Update idxCount, the structured clone process may trigger content code + // via getters/other which can potentially call CreateIndex/DeleteIndex. + idxCount = indexes.Length(); } aUpdateInfoArray.SetCapacity(idxCount); // Pretty good estimate