[gjs/wip/ptomato/mozjs52: 32/34] js: Adapt to misc API changes in SpiderMonkey 52



commit 4a628eed09a4f1398169451bea43c48df3f9c950
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue May 2 22:06:58 2017 -0700

    js: Adapt to misc API changes in SpiderMonkey 52
    
    - JS::InitSelfHostedCode() is now required to be called before the first
      global object is created.
    - js::GCMethods<T>::initial was moved from the friend API to the public
      API and renamed JS::GCPolicy<T>::initial.
    - JSPropertyDescriptor was renamed JS::PropertyDescriptor.
    - JS::CloneAndExecuteScript() now takes a return value parameter, even
      though we don't use it in this case.

 gjs/context.cpp       |    3 +++
 gjs/coverage.cpp      |    3 ++-
 gjs/importer.cpp      |    2 +-
 gjs/jsapi-util-root.h |    4 ++--
 4 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 699b65d..d94742c 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -506,6 +506,9 @@ gjs_context_constructed(GObject *object)
     JS_SetContextPrivate(js_context->context, js_context);
     JS::RootedObject global(js_context->context);
 
+    if (!JS::InitSelfHostedCode(js_context->context))
+        g_error("Failed to intialize JS embedding");
+
     if (!gjs_init_context_standard(js_context->context, &global))
         g_error("Failed to initialize context");
 
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index f0fba85..d3cfb14 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1320,7 +1320,8 @@ gjs_context_eval_file_in_compartment(GjsContext      *context,
                      &compiled_script))
         return false;
 
-    if (!JS::CloneAndExecuteScript(js_context, compiled_script)) {
+    JS::RootedValue dummy_rval(js_context);
+    if (!JS::CloneAndExecuteScript(js_context, compiled_script, &dummy_rval)) {
         g_free(script);
         gjs_log_exception(js_context);
         g_set_error(error, GJS_ERROR, GJS_ERROR_FAILED, "Failed to evaluate %s", filename);
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 65a258d..fb54dd6 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -211,7 +211,7 @@ seal_import(JSContext       *cx,
             JS::HandleId     id,
             const char      *name)
 {
-    JS::Rooted<JSPropertyDescriptor> descr(cx);
+    JS::Rooted<JS::PropertyDescriptor> descr(cx);
 
     if (!JS_GetOwnPropertyDescriptorById(cx, obj, id, &descr) ||
         descr.object() == NULL) {
diff --git a/gjs/jsapi-util-root.h b/gjs/jsapi-util-root.h
index 55ca481..70b7e24 100644
--- a/gjs/jsapi-util-root.h
+++ b/gjs/jsapi-util-root.h
@@ -216,7 +216,7 @@ public:
     {
         debug("root()");
         g_assert(!m_rooted);
-        g_assert(m_heap.get() == js::GCMethods<T>::initial());
+        g_assert(m_heap.get() == JS::GCPolicy<T>::initial());
         m_rooted = true;
         m_cx = cx;
         m_notify = notify;
@@ -243,7 +243,7 @@ public:
     {
         debug("reset()");
         if (!m_rooted) {
-            m_heap = js::GCMethods<T>::initial();
+            m_heap = JS::GCPolicy<T>::initial();
             return;
         }
 


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