Skip to content

Commit 7c4df88

Browse files
committed
avm2: Enable stack traces for Flash Player 11.5+
For Flash Player 11.5 and later, stack traces are always enabled. Some content uses this behavior to verify whether the user is using Flash Player 11.5 onwards. See <https://docs.ruffle.rs/en_US/FlashPlatform/reference/actionscript/3/Error.html#getStackTrace()>
1 parent 8880554 commit 7c4df88

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/src/avm2/object/error_object.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ pub fn error_allocator<'gc>(
1919
) -> Result<Object<'gc>, Error<'gc>> {
2020
let base = ScriptObjectData::new(class);
2121

22-
let call_stack = (enabled!(Level::INFO) || cfg!(feature = "avm_debug"))
22+
// See <https://docs.ruffle.rs/en_US/FlashPlatform/reference/actionscript/3/Error.html#getStackTrace()>
23+
let stack_trace_enabled =
24+
// For Flash Player 11.5+, stack traces are always enabled.
25+
activation.context.player_version >= 18
26+
// For Flash Player 11.4 and earlier, stack traces are only enabled in debug builds.
27+
|| cfg!(feature = "avm_debug")
28+
// But also allow enabling them with log level >= INFO.
29+
|| enabled!(Level::INFO);
30+
31+
let call_stack = stack_trace_enabled
2332
.then(|| activation.avm2().call_stack().borrow().clone())
2433
.unwrap_or_default();
2534

0 commit comments

Comments
 (0)