[gjs/wip/ptomato/mozjs31: 14/22] js: Remove deprecated JS_ValueToString()



commit c2cb90d7d03cef5d59748a932c22853a92fa4b25
Author: Philip Chimento <philip endlessm com>
Date:   Tue Oct 18 13:52:52 2016 -0700

    js: Remove deprecated JS_ValueToString()
    
    In mozjs31 this is replaced with JS::ToString().

 gi/arg.cpp          |    4 ++--
 gjs/context.cpp     |   18 +++++++++---------
 gjs/coverage.cpp    |    6 +++---
 gjs/jsapi-util.cpp  |    4 ++--
 modules/console.cpp |    4 ++--
 5 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index f1ea20f..e83cba8 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -416,7 +416,7 @@ value_to_ghashtable_key(JSContext      *cx,
         char *cstr;                                                   \
         JS::RootedValue str_val(cx, value);                           \
         if (!str_val.isString()) {                                    \
-            JS::RootedString str(cx, JS_ValueToString(cx, str_val));  \
+            JS::RootedString str(cx, JS::ToString(cx, str_val));      \
             str_val.setString(str);                                   \
         }                                                             \
         if (!gjs_string_to_##lctype(cx, str_val, &cstr))              \
@@ -2555,7 +2555,7 @@ gjs_object_from_g_hash (JSContext             *context,
                                        true))
             goto out;
 
-        keystr = JS_ValueToString(context, keyjs);
+        keystr = JS::ToString(context, keyjs);
         if (!keystr)
             goto out;
 
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 183cda0..a666b13 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -118,10 +118,10 @@ gjs_log(JSContext *context,
 
     JS_BeginRequest(context);
 
-    /* JS_ValueToString might throw, in which we will only
-     *log that the value could be converted to string */
+    /* JS::ToString might throw, in which case we will only log that the value
+     * could not be converted to string */
     exc_state = JS_SaveExceptionState(context);
-    JS::RootedString jstr(context, JS_ValueToString(context, argv[0]));
+    JS::RootedString jstr(context, JS::ToString(context, argv[0]));
     if (jstr != NULL)
         argv[0].setString(jstr);  // GC root
     JS_RestoreExceptionState(context, exc_state);
@@ -163,10 +163,10 @@ gjs_log_error(JSContext *context,
     JS::RootedString jstr(context);
 
     if (argc == 2) {
-        /* JS_ValueToString might throw, in which we will only
-         *log that the value could be converted to string */
+        /* JS::ToString might throw, in which case we will only log that the
+         * value could be converted to string */
         exc_state = JS_SaveExceptionState(context);
-        jstr = JS_ValueToString(context, argv[1]);
+        jstr = JS::ToString(context, argv[1]);
         if (jstr != NULL)
             argv[1].setString(jstr);  // GC root
         JS_RestoreExceptionState(context, exc_state);
@@ -194,11 +194,11 @@ gjs_print_parse_args(JSContext *context,
     for (n = 0; n < argv.length(); ++n) {
         JSExceptionState *exc_state;
 
-        /* JS_ValueToString might throw, in which we will only
-         * log that the value could be converted to string */
+        /* JS::ToString might throw, in which case we will only log that the
+         * value could not be converted to string */
         exc_state = JS_SaveExceptionState(context);
 
-        JS::RootedString jstr(context, JS_ValueToString(context, argv[n]));
+        JS::RootedString jstr(context, JS::ToString(context, argv[n]));
         if (jstr != NULL)
             argv[n].setString(jstr); // GC root
 
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 36bdebe..f93da44 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1322,10 +1322,10 @@ coverage_log(JSContext *context,
         return true;
     }
 
-    /* JS_ValueToString might throw, in which we will only
-     *log that the value could be converted to string */
+    /* JS::ToString might throw, in which case we will only log that the value
+     * could not be converted to string */
     exc_state = JS_SaveExceptionState(context);
-    JS::RootedString jstr(context, JS_ValueToString(context, argv[0]));
+    JS::RootedString jstr(context, JS::ToString(context, argv[0]));
     if (jstr != NULL)
         argv[0].setString(jstr);  // GC root
     JS_RestoreExceptionState(context, exc_state);
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index b9ba263..d6c3401 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -445,7 +445,7 @@ gjs_value_debug_string(JSContext      *context,
 
     JS_BeginRequest(context);
 
-    JS::RootedString str(context, JS_ValueToString(context, value));
+    JS::RootedString str(context, JS::ToString(context, value));
 
     if (str == NULL) {
         if (value.isObject()) {
@@ -494,7 +494,7 @@ utf8_exception_from_non_gerror_value(JSContext      *cx,
                                      JS::HandleValue exc)
 {
     char *utf8_exception = NULL;
-    JS::RootedString exc_str(cx, JS_ValueToString(cx, exc));
+    JS::RootedString exc_str(cx, JS::ToString(cx, exc));
     if (exc_str != NULL)
         gjs_string_to_utf8(cx, JS::StringValue(exc_str), &utf8_exception);
     return utf8_exception;
diff --git a/modules/console.cpp b/modules/console.cpp
index a15cbbc..817c722 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -200,12 +200,12 @@ gjs_console_interact(JSContext *context,
         gjs_schedule_gc_if_needed(context);
 
         if (JS_GetPendingException(context, &result)) {
-            str = JS_ValueToString(context, result);
+            str = JS::ToString(context, result);
             JS_ClearPendingException(context);
         } else if (result.isUndefined()) {
             goto next;
         } else {
-            str = JS_ValueToString(context, result);
+            str = JS::ToString(context, result);
         }
 
         if (str) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]