[gjs/wip/js17: 8/14] Misc API changes



commit 1833d5727959abf73e3c93157ae794fbfca2e008
Author: Tim Lunn <tim feathertop org>
Date:   Wed Jan 9 18:54:15 2013 +1100

    Misc API changes
    
    E4X is disabled by default in esr17, re-enable this. jscntxt.h is no longer a public header
    and replace some deprecated API, with equivalent calls.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690982

 gjs/context.c         |    2 +-
 gjs/jsapi-private.cpp |    2 +-
 gjs/jsapi-util.c      |    2 +-
 gjs/stack.c           |   13 ++++++-------
 4 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/gjs/context.c b/gjs/context.c
index cedce2c..7a6a774 100644
--- a/gjs/context.c
+++ b/gjs/context.c
@@ -573,7 +573,7 @@ gjs_context_constructor (GType                  type,
      *
      * JSOPTION_STRICT: Report warnings to error reporter function.
      */
-    options_flags = JSOPTION_DONT_REPORT_UNCAUGHT | JSOPTION_STRICT;
+    options_flags = JSOPTION_DONT_REPORT_UNCAUGHT | JSOPTION_STRICT | JSOPTION_ALLOW_XML;
 
 #ifdef JSOPTION_JIT
     if (!g_getenv("GJS_DISABLE_JIT")) {
diff --git a/gjs/jsapi-private.cpp b/gjs/jsapi-private.cpp
index 463619f..5f39053 100644
--- a/gjs/jsapi-private.cpp
+++ b/gjs/jsapi-private.cpp
@@ -35,7 +35,7 @@
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
 #pragma GCC diagnostic ignored "-Winvalid-offsetof"
-#include <jscntxt.h>
+#include <jsfriendapi.h>
 #pragma GCC diagnostic pop
 
 void
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 2aa6f06..7be0107 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -102,7 +102,7 @@ gboolean
 gjs_init_context_standard (JSContext       *context)
 {
     JSObject *global;
-    global = JS_NewCompartmentAndGlobalObject(context, &global_class, NULL);
+    global = JS_NewGlobalObject(context, &global_class, NULL);
     if (global == NULL)
         return FALSE;
     if (!JS_InitStandardClasses(context, global))
diff --git a/gjs/stack.c b/gjs/stack.c
index aec76ed..06c78fe 100644
--- a/gjs/stack.c
+++ b/gjs/stack.c
@@ -100,16 +100,17 @@ format_frame(JSContext* cx, JSStackFrame* fp,
 
     (void)JS_EnterLocalRootScope(cx);
 
-    if (!JS_IsScriptFrame(cx, fp)) {
-        g_string_append_printf(buf, "%d [native frame]\n", num);
-        goto out;
-    }
-
     /* get the info for this stack frame */
 
     script = JS_GetFrameScript(cx, fp);
     pc = JS_GetFramePC(cx, fp);
 
+    if (!script) {
+        g_string_append_printf(buf, "%d [native frame]\n", num);
+        goto out;
+    }
+
+
     if (script && pc) {
         filename = JS_GetScriptFilename(cx, script);
         lineno =  (guint32) JS_PCToLineNumber(cx, script, pc);
@@ -143,7 +144,6 @@ format_frame(JSContext* cx, JSStackFrame* fp,
         char *name = NULL;
         char *value = NULL;
         JSPropertyDesc* desc = &call_props.array[i];
-        if(desc->flags & JSPD_ARGUMENT) {
             name = jsvalue_to_string(cx, desc->id, &is_string);
             if(!is_string) {
                 g_free(name);
@@ -159,7 +159,6 @@ format_frame(JSContext* cx, JSStackFrame* fp,
                                    value ? value : "?unknown?",
                                    is_string ? "\"" : "");
             named_arg_count++;
-        }
         g_free(name);
         g_free(value);
     }


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