summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-02 10:32:53 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-02 10:32:53 +0100
commitdeba73b3bc9168838034c2b5bab4b7d2945bfaaf (patch)
treeb83278806048b9baf39c4d088ee87049116de1bd /js
parent09fec033ec18a5c0eb29815924114016cee32a00 (diff)
downloadUXP-deba73b3bc9168838034c2b5bab4b7d2945bfaaf.tar
UXP-deba73b3bc9168838034c2b5bab4b7d2945bfaaf.tar.gz
UXP-deba73b3bc9168838034c2b5bab4b7d2945bfaaf.tar.lz
UXP-deba73b3bc9168838034c2b5bab4b7d2945bfaaf.tar.xz
UXP-deba73b3bc9168838034c2b5bab4b7d2945bfaaf.zip
Fix a longstanding IndexedDB correctness issue.
Standards Compliance fix, port of Bug 1492737
Diffstat (limited to 'js')
-rw-r--r--js/src/jsapi.cpp18
-rw-r--r--js/src/jsapi.h6
2 files changed, 20 insertions, 4 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index 85a38bba4..37d023bd4 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -2003,10 +2003,10 @@ JS_GetOwnPropertyDescriptor(JSContext* cx, HandleObject obj, const char* name,
}
JS_PUBLIC_API(bool)
-JS_GetOwnUCPropertyDescriptor(JSContext* cx, HandleObject obj, const char16_t* name,
+JS_GetOwnUCPropertyDescriptor(JSContext* cx, HandleObject obj, const char16_t* name, size_t namelen,
MutableHandle<PropertyDescriptor> desc)
{
- JSAtom* atom = AtomizeChars(cx, name, js_strlen(name));
+ JSAtom* atom = AtomizeChars(cx, name, namelen);
if (!atom)
return false;
RootedId id(cx, AtomToId(atom));
@@ -2028,7 +2028,19 @@ JS_GetPropertyDescriptor(JSContext* cx, HandleObject obj, const char* name,
if (!atom)
return false;
RootedId id(cx, AtomToId(atom));
- return atom && JS_GetPropertyDescriptorById(cx, obj, id, desc);
+ return JS_GetPropertyDescriptorById(cx, obj, id, desc);
+}
+
+JS_PUBLIC_API(bool)
+JS_GetUCPropertyDescriptor(JSContext* cx, HandleObject obj, const char16_t* name, size_t namelen,
+ MutableHandle<PropertyDescriptor> desc)
+{
+ JSAtom* atom = AtomizeChars(cx, name, namelen);
+ if (!atom) {
+ return false;
+ }
+ RootedId id(cx, AtomToId(atom));
+ return JS_GetPropertyDescriptorById(cx, obj, id, desc);
}
static bool
diff --git a/js/src/jsapi.h b/js/src/jsapi.h
index c1195cc00..30c4a835a 100644
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -2917,7 +2917,7 @@ JS_GetOwnPropertyDescriptor(JSContext* cx, JS::HandleObject obj, const char* nam
JS::MutableHandle<JS::PropertyDescriptor> desc);
extern JS_PUBLIC_API(bool)
-JS_GetOwnUCPropertyDescriptor(JSContext* cx, JS::HandleObject obj, const char16_t* name,
+JS_GetOwnUCPropertyDescriptor(JSContext* cx, JS::HandleObject obj, const char16_t* name, size_t namelen,
JS::MutableHandle<JS::PropertyDescriptor> desc);
/**
@@ -2934,6 +2934,10 @@ extern JS_PUBLIC_API(bool)
JS_GetPropertyDescriptor(JSContext* cx, JS::HandleObject obj, const char* name,
JS::MutableHandle<JS::PropertyDescriptor> desc);
+extern JS_PUBLIC_API(bool)
+JS_GetUCPropertyDescriptor(JSContext* cx, JS::HandleObject obj, const char16_t* name, size_t namelen,
+ JS::MutableHandle<JS::PropertyDescriptor> desc);
+
/**
* Define a property on obj.
*