diff --git a/mozjs-sys/Cargo.toml b/mozjs-sys/Cargo.toml index ec647fc386..b7ee879634 100644 --- a/mozjs-sys/Cargo.toml +++ b/mozjs-sys/Cargo.toml @@ -2,7 +2,7 @@ name = "mozjs_sys" description = "System crate for the Mozilla SpiderMonkey JavaScript engine." repository.workspace = true -version = "0.128.6-0" +version = "0.128.6-1" authors = ["Mozilla"] links = "mozjs" build = "build.rs" diff --git a/mozjs-sys/src/jsglue.cpp b/mozjs-sys/src/jsglue.cpp index f81b1fef6e..5f20d0c64c 100644 --- a/mozjs-sys/src/jsglue.cpp +++ b/mozjs-sys/src/jsglue.cpp @@ -31,6 +31,7 @@ #include "js/experimental/JSStencil.h" #include "js/experimental/JitInfo.h" #include "js/experimental/TypedData.h" +#include "js/friend/DumpFunctions.h" #include "js/friend/ErrorMessages.h" #include "jsapi.h" #include "jsfriendapi.h" @@ -1071,4 +1072,16 @@ void SetAccessorPropertyDescriptor( desc.set(JS::PropertyDescriptor::Accessor(getter, setter, attrs)); } +void DumpJSStack(JSContext* cx, bool showArgs, bool showLocals, + bool showThisProps) { + JS::AutoSaveExceptionState state(cx); + + JS::UniqueChars buf = + JS::FormatStackDump(cx, showArgs, showLocals, showThisProps); + + state.restore(); + + printf("%s\n", buf.get()); +} + } // extern "C"