[gjs] coverage: Enter correct compartment
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] coverage: Enter correct compartment
- Date: Wed, 28 Sep 2016 02:00:30 +0000 (UTC)
commit 313de7069b942148a1a35c31dca26a358b152358
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Sep 26 23:09:15 2016 -0700
coverage: Enter correct compartment
To use JS_GetGlobalForObject(), the context argument must be in the same
compartment as the second argument. Since this call was part of another
call entering that compartment, then the context was not already in that
compartment, so the call triggers an assertion if mozjs is compiled with
debug flags.
Instead, we can use the second argument directly to indicate which
compartment to enter.
https://bugzilla.gnome.org/show_bug.cgi?id=573335
gjs/coverage.cpp | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 92b3beb..8afd762 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1010,9 +1010,7 @@ gjs_serialize_statistics(GjsCoverage *coverage)
JSRuntime *js_runtime = JS_GetRuntime(js_context);
JSAutoRequest ar(js_context);
- JSAutoCompartment ac(js_context,
- JS_GetGlobalForObject(js_context,
- priv->coverage_statistics));
+ JSAutoCompartment ac(js_context, priv->coverage_statistics);
JS::RootedValue string_value_return(js_runtime);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]