summaryrefslogtreecommitdiffstats
path: root/dom/xbl/nsXBLProtoImpl.cpp
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 /dom/xbl/nsXBLProtoImpl.cpp
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 'dom/xbl/nsXBLProtoImpl.cpp')
-rw-r--r--dom/xbl/nsXBLProtoImpl.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/dom/xbl/nsXBLProtoImpl.cpp b/dom/xbl/nsXBLProtoImpl.cpp
index 4db9cabf0..5efcb71e0 100644
--- a/dom/xbl/nsXBLProtoImpl.cpp
+++ b/dom/xbl/nsXBLProtoImpl.cpp
@@ -100,11 +100,15 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
// end up with a different content prototype, but we'll already have a property
// holder called |foo| in the XBL scope. Check for that to avoid wasteful and
// weird property holder duplication.
- const char16_t* className = aPrototypeBinding->ClassName().get();
+ const nsString& className = aPrototypeBinding->ClassName();
+ const char16_t* classNameChars = className.get();
+ const size_t classNameLen = className.Length();
+
JS::Rooted<JSObject*> propertyHolder(cx);
JS::Rooted<JS::PropertyDescriptor> existingHolder(cx);
if (scopeObject != globalObject &&
- !JS_GetOwnUCPropertyDescriptor(cx, scopeObject, className, &existingHolder)) {
+ !JS_GetOwnUCPropertyDescriptor(cx, scopeObject, classNameChars,
+ classNameLen, &existingHolder)) {
return NS_ERROR_FAILURE;
}
bool propertyHolderIsNew = !existingHolder.object() || !existingHolder.value().isObject();
@@ -119,8 +123,8 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aPrototypeBinding,
// Define it as a property on the scopeObject, using the same name used on
// the content side.
- bool ok = JS_DefineUCProperty(cx, scopeObject, className, -1, propertyHolder,
- JSPROP_PERMANENT | JSPROP_READONLY,
+ bool ok = JS_DefineUCProperty(cx, scopeObject, classNameChars, classNameLen,
+ propertyHolder, JSPROP_PERMANENT | JSPROP_READONLY,
JS_STUBGETTER, JS_STUBSETTER);
NS_ENSURE_TRUE(ok, NS_ERROR_UNEXPECTED);
} else {