Bug 1285917 - Expose InformalValueType in JSAPI. r=jorendorff, a=jcristau
authorNicolas Auvray <na.itms76@gmail.com>
Tue, 08 Nov 2016 18:49:36 +0100
changeset 352675 64c2b28ed882237e1615b4d4bae427400cc7cc88
parent 352674 06e5a06d89b3688eb674b40b96419129a666da3e
child 352676 be65a95a6b4b0f22d238003e367539a6336e88be
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, jcristau
bugs1285917
milestone52.0a2
Bug 1285917 - Expose InformalValueType in JSAPI. r=jorendorff, a=jcristau
js/src/jsapi.h
js/src/jsobj.cpp
js/src/jsobj.h
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -947,16 +947,23 @@ extern JS_PUBLIC_API(JSString*)
 JS_ValueToSource(JSContext* cx, JS::Handle<JS::Value> v);
 
 extern JS_PUBLIC_API(bool)
 JS_DoubleIsInt32(double d, int32_t* ip);
 
 extern JS_PUBLIC_API(JSType)
 JS_TypeOfValue(JSContext* cx, JS::Handle<JS::Value> v);
 
+namespace JS {
+
+extern JS_PUBLIC_API(const char*)
+InformalValueTypeName(const JS::Value& v);
+
+} /* namespace JS */
+
 extern JS_PUBLIC_API(bool)
 JS_StrictlyEqual(JSContext* cx, JS::Handle<JS::Value> v1, JS::Handle<JS::Value> v2, bool* equal);
 
 extern JS_PUBLIC_API(bool)
 JS_LooselyEqual(JSContext* cx, JS::Handle<JS::Value> v1, JS::Handle<JS::Value> v2, bool* equal);
 
 extern JS_PUBLIC_API(bool)
 JS_SameValue(JSContext* cx, JS::Handle<JS::Value> v1, JS::Handle<JS::Value> v2, bool* same);
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -82,18 +82,18 @@ js::ReportNotObject(JSContext* cx, const
 
     RootedValue value(cx, v);
     UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, value, nullptr);
     if (bytes)
         JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT,
                                    bytes.get());
 }
 
-const char*
-js::InformalValueTypeName(const Value& v)
+JS_PUBLIC_API(const char*)
+JS::InformalValueTypeName(const Value& v)
 {
     if (v.isObject())
         return v.toObject().getClass()->name;
     if (v.isString())
         return "string";
     if (v.isSymbol())
         return "symbol";
     if (v.isNumber())
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1331,18 +1331,16 @@ inline JSObject*
 NonNullObject(JSContext* cx, const Value& v)
 {
     if (v.isObject())
         return &v.toObject();
     ReportNotObject(cx, v);
     return nullptr;
 }
 
-extern const char*
-InformalValueTypeName(const Value& v);
 
 extern bool
 GetFirstArgumentAsObject(JSContext* cx, const CallArgs& args, const char* method,
                          MutableHandleObject objp);
 
 /* Helpers for throwing. These always return false. */
 extern bool
 Throw(JSContext* cx, jsid id, unsigned errorNumber);