summaryrefslogtreecommitdiffstats
path: root/js/src/jsstr.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 17:11:49 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:19 -0400
commit668254e2b2a7b4f1d6da703275b89f3753096f71 (patch)
tree6120c3a0456fc1983f30685d17920a92b3397998 /js/src/jsstr.cpp
parentafb28a43d481075a244b0e18faa8447dfadacf8f (diff)
downloadUXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar
UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar.gz
UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar.lz
UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.tar.xz
UXP-668254e2b2a7b4f1d6da703275b89f3753096f71.zip
903389 - Fix uses of ClassMethodIsNative.
Diffstat (limited to 'js/src/jsstr.cpp')
-rw-r--r--js/src/jsstr.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp
index d7db5129d..3fecb463d 100644
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -461,9 +461,13 @@ ToStringForStringFunction(JSContext* cx, HandleValue thisv)
RootedObject obj(cx, &thisv.toObject());
if (obj->is<StringObject>()) {
StringObject* nobj = &obj->as<StringObject>();
- Rooted<jsid> id(cx, NameToId(cx->names().toString));
- if (ClassMethodIsNative(cx, nobj, &StringObject::class_, id, str_toString))
+ // We have to make sure that the ToPrimitive call from ToString
+ // would be unobservable.
+ if (HasNoToPrimitiveMethodPure(nobj, cx) &&
+ HasNativeMethodPure(nobj, cx->names().toString, str_toString, cx))
+ {
return nobj->unbox();
+ }
}
} else if (thisv.isNullOrUndefined()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,