Bug 1285917 - Expose InformalValueType in JSAPI. r=jorendorff
authorNicolas Auvray <na.itms76@gmail.com>
Tue, 08 Nov 2016 18:49:36 +0100
changeset 323915 71a163471efd17c6a74c42093efddb3c7a84ad6b
parent 323914 7653eef0aae24f3a525e0327d907f62d8fcad9ba
child 323916 09620b9e6d069a45be1f7e2375acfad144b24f53
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjorendorff
bugs1285917
milestone53.0a1
Bug 1285917 - Expose InformalValueType in JSAPI. r=jorendorff
js/src/jsapi.h
js/src/jsobj.cpp
js/src/jsobj.h
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -948,16 +948,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);