[gjs] jsapi-util-error: Enter the global object compartment



commit cd8bb8150bb424932ccf003b534994136207df6e
Author: Sam Spilsbury <smspillaz gmail com>
Date:   Fri Jan 17 18:11:42 2014 -0200

    jsapi-util-error: Enter the global object compartment
    
    If another compartment throws an exception we set properties
    on our global object so enter its compartment.

 gjs/jsapi-util-error.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index bb7e85b..91b68e4 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -54,6 +54,8 @@ gjs_throw_valist(JSContext       *context,
 
     s = g_strdup_vprintf(format, args);
 
+    JSAutoCompartment compartment(context, JS_GetGlobalObject(context));
+
     JS_BeginRequest(context);
 
     if (JS_IsExceptionPending(context)) {


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