diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /js/src/vm/JSContext.cpp | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/vm/JSContext.cpp')
-rw-r--r-- | js/src/vm/JSContext.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/js/src/vm/JSContext.cpp b/js/src/vm/JSContext.cpp index 4d355dc828..5a4bfa86cd 100644 --- a/js/src/vm/JSContext.cpp +++ b/js/src/vm/JSContext.cpp @@ -55,6 +55,7 @@ #include "vm/BytecodeUtil.h" // JSDVG_IGNORE_STACK #include "vm/ErrorObject.h" #include "vm/ErrorReporting.h" +#include "vm/FrameIter.h" #include "vm/JSFunction.h" #include "vm/JSObject.h" #include "vm/PlainObject.h" // js::PlainObject @@ -997,7 +998,6 @@ JSContext::JSContext(JSRuntime* runtime, const JS::ContextOptions& options) suppressProfilerSampling(false), tempLifoAlloc_(this, (size_t)TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), debuggerMutations(this, 0), - ionPcScriptCache(this, nullptr), status(this, JS::ExceptionStatus::None), unwrappedException_(this), unwrappedExceptionStack_(this), @@ -1263,6 +1263,34 @@ void JSContext::resetJitStackLimit() { void JSContext::initJitStackLimit() { resetJitStackLimit(); } +JSScript* JSContext::currentScript(jsbytecode** ppc, + AllowCrossRealm allowCrossRealm) { + if (ppc) { + *ppc = nullptr; + } + + // Fast path: there are no JS frames on the stack if there's no activation. + if (!activation()) { + return nullptr; + } + + FrameIter iter(this); + if (iter.done() || !iter.hasScript()) { + return nullptr; + } + + JSScript* script = iter.script(); + if (allowCrossRealm == AllowCrossRealm::DontAllow && + script->realm() != realm()) { + return nullptr; + } + + if (ppc) { + *ppc = iter.pc(); + } + return script; +} + #ifdef JS_CRASH_DIAGNOSTICS void ContextChecks::check(AbstractFramePtr frame, int argIndex) { if (frame) { |