From 190f9176df202a5bad615d9b83b7dd1ed668be3d Mon Sep 17 00:00:00 2001 From: leper Date: Sat, 19 Dec 2015 02:21:22 +0000 Subject: [PATCH] SpiderMonkey 38 removes JS_NewPropertyIterator, use JS_Enumerate instead. https://bugzilla.mozilla.org/show_bug.cgi?id=1081660 This was SVN commit r17510. --- source/scriptinterface/ScriptInterface.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp index 54fb04f133..9997b0df77 100644 --- a/source/scriptinterface/ScriptInterface.cpp +++ b/source/scriptinterface/ScriptInterface.cpp @@ -767,19 +767,17 @@ bool ScriptInterface::EnumeratePropertyNamesWithPrefix(JS::HandleValue objVal, c return true; // reached the end of the prototype chain JS::RootedObject obj(m->m_cx, &objVal.toObject()); - JS::RootedObject it(m->m_cx, JS_NewPropertyIterator(m->m_cx, obj)); - if (!it) + JS::AutoIdArray props(m->m_cx, JS_Enumerate(m->m_cx, obj)); + if (!props) return false; - while (true) + for (size_t i = 0; i < props.length(); ++i) { - JS::RootedId idp(m->m_cx); + JS::RootedId id(m->m_cx, props[i]); JS::RootedValue val(m->m_cx); - if (! JS_NextProperty(m->m_cx, it, idp.address()) || ! JS_IdToValue(m->m_cx, idp, &val)) + if (!JS_IdToValue(m->m_cx, id, &val)) return false; - if (val.isUndefined()) - break; // end of iteration if (!val.isString()) continue; // ignore integer properties