[gjs/wip/ptomato/mozjs52: 4/35] tests: Root using context, not runtime



commit b3fdd60d161467356ace3cd527efb373f924e61f
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]