[gjs/wip/ptomato/mozjs52: 3/33] tests: Root using context, not runtime



commit db9f6a7d4da81b779d900396cd5a655da77ad1e9
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Jun 4 14:51:53 2017 -0400

    tests: Root using context, not runtime
    
    JSRuntime is going away in SpiderMonkey 52, so we should stop using the
    constructor of JS::Rooted<T> that takes JSRuntime instead of JSContext.
    There were a few instances I missed in the previous commit that fixed
    this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781429

 test/gjs-test-coverage.cpp |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index c613644..e19c652 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -1641,10 +1641,9 @@ test_coverage_cache_as_js_object_has_expected_properties(gpointer      fixture_d
     };
 
     GBytes *cache = serialize_ast_to_bytes(fixture->coverage, coverage_paths);
-    JS::RootedString cache_results(JS_GetRuntime((JSContext *) 
gjs_context_get_native_context(fixture->context)),
-                                   gjs_deserialize_cache_to_object(fixture->coverage, cache));
-    JS::RootedValue cache_result_value(JS_GetRuntime((JSContext *) 
gjs_context_get_native_context(fixture->context)),
-                                       JS::StringValue(cache_results));
+    auto cx = static_cast<JSContext *>(gjs_context_get_native_context(fixture->context));
+    JS::RootedValue cache_result_value(cx,
+        JS::StringValue(gjs_deserialize_cache_to_object(fixture->coverage, cache)));
     gjs_inject_value_into_coverage_compartment(fixture->coverage,
                                                cache_result_value,
                                                "coverage_cache");


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