[gjs] js: Have an active request where needed
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] js: Have an active request where needed
- Date: Fri, 11 Nov 2016 00:25:37 +0000 (UTC)
commit 1340fde286d8448ad0d001c0ec8c3be645573651
Author: Philip Chimento <philip endlessm com>
Date: Thu Nov 10 13:21:20 2016 -0800
js: Have an active request where needed
This was surfaced by #defining DEBUG. In two places, we tried to create a
JS::Rooted without being in a request, which is not allowed.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
gjs/context.cpp | 2 ++
gjs/coverage.cpp | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 6bf1536..7c4ba33 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -721,6 +721,8 @@ gjs_context_define_string_array(GjsContext *js_context,
GError **error)
{
JSAutoCompartment ac(js_context->context, js_context->global);
+ JSAutoRequest ar(js_context->context);
+
JS::RootedObject global_root(js_context->context, js_context->global);
if (!gjs_define_string_array(js_context->context,
global_root,
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 19dd1a5..d33e138 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1493,6 +1493,8 @@ gjs_run_script_in_coverage_compartment(GjsCoverage *coverage,
GjsCoveragePrivate *priv = (GjsCoveragePrivate *) gjs_coverage_get_instance_private(coverage);
JSContext *js_context = (JSContext *) gjs_context_get_native_context(priv->context);
JSAutoCompartment ac(js_context, priv->coverage_statistics);
+ JSAutoRequest ar(js_context);
+
JS::RootedValue rval(js_context);
JS::RootedObject rooted_priv(js_context, priv->coverage_statistics);
if (!gjs_eval_with_scope(js_context, rooted_priv, script, strlen(script),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]