[gjs: 12/25] gerror: Pass null JSPrincipals to saved frame API calls



commit 5a6154586bfc9afcf03260db6193289699066b70
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon May 20 17:42:31 2019 -0700

    gerror: Pass null JSPrincipals to saved frame API calls
    
    The saved frame API now requires a pointer to JSPrincipals. According to
    the SpiderMonkey developers, we can just pass null here and ignore it
    unless we are using JS_SetSecurityCallbacks(), which we are not.

 gi/gerror.cpp            | 9 +++++----
 gjs/jsapi-util-error.cpp | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index ca45c384..d538d45d 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -27,6 +27,7 @@
 #include <glib-object.h>
 
 #include "gjs/jsapi-wrapper.h"
+#include "js/SavedFrameAPI.h"
 
 #include "gi/boxed.h"
 #include "gi/enumeration.h"
@@ -286,13 +287,13 @@ bool gjs_define_error_properties(JSContext* cx, JS::HandleObject obj) {
     uint32_t line, column;
 
     if (!JS::CaptureCurrentStack(cx, &frame) ||
-        !JS::BuildStackString(cx, frame, &stack))
+        !JS::BuildStackString(cx, nullptr, frame, &stack))
         return false;
 
     auto ok = JS::SavedFrameResult::Ok;
-    if (JS::GetSavedFrameSource(cx, frame, &source) != ok ||
-        JS::GetSavedFrameLine(cx, frame, &line) != ok ||
-        JS::GetSavedFrameColumn(cx, frame, &column) != ok) {
+    if (JS::GetSavedFrameSource(cx, nullptr, frame, &source) != ok ||
+        JS::GetSavedFrameLine(cx, nullptr, frame, &line) != ok ||
+        JS::GetSavedFrameColumn(cx, nullptr, frame, &column) != ok) {
         gjs_throw(cx, "Error getting saved frame information");
         return false;
     }
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 2de11199..55d9f466 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -210,7 +210,7 @@ gjs_format_stack_trace(JSContext       *cx,
 
     JS::RootedString stack_trace(cx);
     JS::UniqueChars stack_utf8;
-    if (JS::BuildStackString(cx, saved_frame, &stack_trace, 2))
+    if (JS::BuildStackString(cx, nullptr, saved_frame, &stack_trace, 2))
         stack_utf8 = JS_EncodeStringToUTF8(cx, stack_trace);
 
     saved_exc.restore();


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