Skip to content

avm2: Fix stack trace for context3DCreated event handler#23745

Open
Lord-McSweeney wants to merge 2 commits into
ruffle-rs:masterfrom
Lord-McSweeney:avm2-fix-context3d-stack
Open

avm2: Fix stack trace for context3DCreated event handler#23745
Lord-McSweeney wants to merge 2 commits into
ruffle-rs:masterfrom
Lord-McSweeney:avm2-fix-context3d-stack

Conversation

@Lord-McSweeney
Copy link
Copy Markdown
Collaborator

@Lord-McSweeney Lord-McSweeney commented May 18, 2026

Description

This PR fixes the stack trace for the context3DCreated event handler. Previously, the event was manually dispatched from AS with a delay. Now, we set some state on the Stage3DObject, which is updated by code in the Stage display object at the beginning of the AVM2 frame lifecycle.

With the previous approach, the stack trace for the failing test avm2/stage3d_agal_upload_errors would have to be updated every time the total function count changed in our playerglobals.

Testing

I've marked the avm2/stage3d_agal_upload_errors test as passing and added a new test, avm2/context3d_creation.

Checklist

  • I, a human, have self-reviewed this PR and fully understand the changes within.
  • I have made or updated tests where possible.
  • All of my commits are properly scoped, compile successfully, and pass all tests.
  • This PR does not make sense to split up into smaller PRs.
  • An LLM was involved in the authoring of this code.

@Lord-McSweeney Lord-McSweeney added A-avm2 Area: AVM2 (ActionScript 3) T-compat Type: Compatibility with Flash Player labels May 18, 2026
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-fix-context3d-stack branch from 2506514 to 38edc3c Compare May 18, 2026 23:43
Previously, the asynchronicity of context3d creation was implemented entirely
in AS using setTimeout. This added extra methods to the stack trace.
Asynchronicity for context3D creation is now handled entirely in Rust.
This removes extra methods from the stack trace from inside the event handler.
@Lord-McSweeney Lord-McSweeney force-pushed the avm2-fix-context3d-stack branch from 38edc3c to 8f09f78 Compare May 18, 2026 23:51
@Lord-McSweeney Lord-McSweeney added the waiting-on-review Waiting on review from a Ruffle team member label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) T-compat Type: Compatibility with Flash Player waiting-on-review Waiting on review from a Ruffle team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant