summaryrefslogtreecommitdiff
path: root/js/src/jsapi.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-09-04 21:04:07 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-09-04 21:04:07 +0200
commit4d4924e5105dbdfdcc3ff821671fba0dfeb11b11 (patch)
treebd337bd4c029744be88847e506b7e03da79e7093 /js/src/jsapi.cpp
parent4266966eeef44dfce422b9703692e519678610c6 (diff)
downloaduxp-4d4924e5105dbdfdcc3ff821671fba0dfeb11b11.tar.gz
Fix a crash in IndexedDB.
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r--js/src/jsapi.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index 84a3155872..cad0840e03 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -2011,6 +2011,28 @@ JS_GetOwnUCPropertyDescriptor(JSContext* cx, HandleObject obj, const char16_t* n
}
JS_PUBLIC_API(bool)
+JS_GetOwnElement(JSContext* cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleValue vp)
+{
+ RootedId id(cx);
+ if (!IndexToId(cx, index, &id)) {
+ return false;
+ }
+
+ Rooted<PropertyDescriptor> desc(cx);
+ if (!JS_GetOwnPropertyDescriptorById(cx, obj, id, &desc)) {
+ return false;
+ }
+
+ if (desc.object() && desc.isDataDescriptor()) {
+ vp.set(desc.value());
+ } else {
+ vp.setUndefined();
+ }
+
+ return true;
+}
+
+JS_PUBLIC_API(bool)
JS_GetPropertyDescriptorById(JSContext* cx, HandleObject obj, HandleId id,
MutableHandle<PropertyDescriptor> desc)
{