summaryrefslogtreecommitdiffstats
path: root/js/src/debugger/Debugger.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /js/src/debugger/Debugger.cpp
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/debugger/Debugger.cpp')
-rw-r--r--js/src/debugger/Debugger.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/js/src/debugger/Debugger.cpp b/js/src/debugger/Debugger.cpp
index 37c1e79a9d..44bd1a8eaa 100644
--- a/js/src/debugger/Debugger.cpp
+++ b/js/src/debugger/Debugger.cpp
@@ -536,6 +536,7 @@ Debugger::Debugger(JSContext* cx, NativeObject* dbg)
exclusiveDebuggerOnEval(false),
inspectNativeCallArguments(false),
collectCoverageInfo(false),
+ shouldAvoidSideEffects(false),
observedGCs(cx->zone()),
allocationsLog(cx),
trackingAllocationSites(false),
@@ -1049,6 +1050,12 @@ NativeResumeMode DebugAPI::slowPathOnNativeCall(JSContext* cx,
return NativeResumeMode::Continue;
}
+/* static */
+bool DebugAPI::slowPathShouldAvoidSideEffects(JSContext* cx) {
+ return DebuggerExists(
+ cx->global(), [=](Debugger* dbg) { return dbg->shouldAvoidSideEffects; });
+}
+
/*
* RAII class to mark a generator as "running" temporarily while running
* debugger code.
@@ -4187,6 +4194,8 @@ struct MOZ_STACK_CLASS Debugger::CallData {
bool setOnEnterFrame();
bool getOnNativeCall();
bool setOnNativeCall();
+ bool getShouldAvoidSideEffects();
+ bool setShouldAvoidSideEffects();
bool getOnNewGlobalObject();
bool setOnNewGlobalObject();
bool getOnNewPromise();
@@ -4405,6 +4414,22 @@ bool Debugger::CallData::setOnNativeCall() {
return true;
}
+bool Debugger::CallData::getShouldAvoidSideEffects() {
+ args.rval().setBoolean(dbg->shouldAvoidSideEffects);
+ return true;
+}
+
+bool Debugger::CallData::setShouldAvoidSideEffects() {
+ if (!args.requireAtLeast(cx, "Debugger.set shouldAvoidSideEffects", 1)) {
+ return false;
+ }
+
+ dbg->shouldAvoidSideEffects = ToBoolean(args[0]);
+
+ args.rval().setUndefined();
+ return true;
+}
+
bool Debugger::CallData::getOnNewGlobalObject() {
return getHookImpl(cx, args, *dbg, OnNewGlobalObject);
}
@@ -4608,6 +4633,11 @@ GlobalObject* Debugger::unwrapDebuggeeArgument(JSContext* cx, const Value& v) {
return nullptr;
}
+ if (JS_IsDeadWrapper(obj)) {
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_DEAD_OBJECT);
+ return nullptr;
+ }
+
// If that didn't produce a global object, it's an error.
if (!obj->is<GlobalObject>()) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
@@ -6518,6 +6548,8 @@ const JSPropertySpec Debugger::properties[] = {
JS_DEBUG_PSGS("onPromiseSettled", getOnPromiseSettled, setOnPromiseSettled),
JS_DEBUG_PSGS("onEnterFrame", getOnEnterFrame, setOnEnterFrame),
JS_DEBUG_PSGS("onNativeCall", getOnNativeCall, setOnNativeCall),
+ JS_DEBUG_PSGS("shouldAvoidSideEffects", getShouldAvoidSideEffects,
+ setShouldAvoidSideEffects),
JS_DEBUG_PSGS("onNewGlobalObject", getOnNewGlobalObject,
setOnNewGlobalObject),
JS_DEBUG_PSGS("uncaughtExceptionHook", getUncaughtExceptionHook,
@@ -7259,5 +7291,9 @@ JS_PUBLIC_API bool FireOnGarbageCollectionHook(
return true;
}
+bool ShouldAvoidSideEffects(JSContext* cx) {
+ return DebugAPI::shouldAvoidSideEffects(cx);
+}
+
} // namespace dbg
} // namespace JS