Commit Graph

44 Commits

Author SHA1 Message Date
Adrian Wielgosik 87ede6a052 avm2: Set correct `this` values in function calls 2023-07-05 22:36:20 +02:00
Nathan Adams afdd617d29 avm1: Add include_hidden: bool to get_keys() 2023-06-21 18:27:12 +02:00
Aaron Hill ad97322807 avm2: Implement ErrorObject.display without using Activation
This lets us print the full error message and stack stacke
in contexts where an Activation is not available, including
the `Debug` impl.

The 'name' and 'error' fields are accessed using hardcodd slot
ids. This is pretty hacky, but will work until we have better
handling of slot properties.
2023-06-15 09:31:36 -05:00
Nathan Adams 137986c384 core: Add PlayerBuilder::with_external_interface 2023-06-09 13:03:46 +02:00
Toad06 35528913bf core: Make `ExternalInterface` support undefined values 2023-04-02 13:48:14 -07:00
Toad06 5e14aabed6 core: Make `ExternalInterface` support undefined values in browsers 2023-04-02 13:48:14 -07:00
Aaron Hill 1a352aa453 avm2: Implement ApplicationDomain constructor and fix parent handling
Previously, the `ApplicationDomain` constructor ignored its argument,
instead of constructing a new domain with the specified domain as
the parent.

Additionally, we were incorrectly executing code with
`Activation::from_nothing` in several places, causing
`ApplicationDomain.currentDomain` to return the system domain
instead of the correct parent domain. I've introduced a new method
`Activation::from_domain`, which allows explicitly passing in the
domain. Internally, we now store an `Option<Domain>`, and panic
when calling `caller_domain` with a `None` domain. Several places
in the codebase have been adjusted to pass in the correct domain.
2023-03-26 17:43:46 -07:00
Nathan Adams e94861a8ad avm2: Convert errors to error messages at root level 2023-03-19 09:15:42 +01:00
Nathan Adams 8b5f6c3691 core: Log when an error is encountered perfoming avm2 callbacks 2023-03-19 09:15:42 +01:00
Nathan Adams 75bf002fc6 core: Make Stage::root_clip() return Option 2023-03-15 10:18:32 +01:00
CUB3D 0d5258fa2a avm1: Remove some mc todos 2023-03-01 22:36:39 +01:00
CUB3D 6ba75d6045 avm1: Refactor movieclip path logic 2023-03-01 22:36:39 +01:00
CUB3D cb3d9f99a7 avm1: Cache MovieClips in Value::MovieClip, this is required to correctly handle changing DO._name and for perf 2023-03-01 22:36:39 +01:00
CUB3D e6d3a99d80 avm1: MovieClips are indirectly referenced by string paths 2023-03-01 22:36:39 +01:00
Aaron Hill 1b71e288fd Remove 'gc_context lifetime
The latest `gc-arena` makes this unnecessary - we can just
use our `'a` lifetime for `MutationContext`
2023-01-06 19:20:39 -05:00
Nathan Adams 13fd830e7c core: Switch from log to tracing 2023-01-06 04:25:22 +01:00
Moulins 5faba34eb2 avm1: remove 'globals' parameter from Activation::from_nothing
Across all invocations, this is always set to the global object so it
can be hard-coded inside the call.
2022-11-23 15:50:45 -07:00
Toad06 eb2ee06588 avm1: Fix `ExternalInterface.call` with blank strings in SWFv8 2022-11-22 16:51:59 -07:00
= ddaee950f8 avm1: Removed all public access into Avm1 modules, export only what's needed 2022-09-04 12:27:29 -07:00
Adrian Wielgosik cc6abab72f avm2: Remove Value::Unsigned, add minimal implicit int->float conversion 2022-09-04 08:57:18 +03:00
relrelb ce5bf557f5 avm2: `ExternalValue::from_avm2` is infallible 2022-09-02 10:10:40 -07:00
relrelb c2e78ffead chore: Appease clippy
Resolve 2 instances of `only_used_in_recursion`.
2022-09-02 10:10:40 -07:00
relrelb 04b4a6cabe avm1: Rename `ScriptObject::object` to `ScriptObject::new` 2022-08-19 12:22:48 -07:00
Mike Welsh f20f53f555 avm1: Grab SWF version from executing clip
Remove the `swf_version` parameter from `Activation` constructors,
because this was incorrectly using the global or root SWF version
most times.

Instead, grab the SWF version for the activation directly from the
base clip.
2022-05-07 10:25:10 -07:00
Aaron Hill 4f23500779 avm2: Implement most of `flash.external.ExternalInterface`
This re-uses the logic we have for handling AVM1's `ExternalInterface`.
For now, serialization/deserialization of non-array objects is
left unimplemented.
2022-03-31 22:40:09 -07:00
Mike Welsh c35edaae82 avm1: Allow `this` to be `undefined`
Change `Activation::this` to be `Value` instead of `Object`.
2022-01-24 02:04:57 -08:00
Moulins fa30e1bc43 chore: rename AvmString::{new -> new_utf8, new_ucs2 -> new} 2021-11-27 11:20:47 -07:00
relrelb 982a83ce24 avm1: Remove `base_proto` parameter of `TObject::call`
Use prototype depths instead. Most calls passed `base_proto = None`,
which is equivalent to `depth = 0`, and is now the default.
The few other cases were adapted to use `Executable::exec` directly,
where `depth` can be specified manually.
2021-10-23 10:51:21 -07:00
Moulins 4ad6e1e698 avm1: Propagate AvmString<'gc>s to all methods on Object
Some frequently-used Object methods have an Into<impl AvmString<'gc>>
parameter to reduce the size of the changes.
2021-10-06 19:47:35 -06:00
Moulins 73bce495c2 chore: move core::avm1::string::AvmString to core::string::AvmString 2021-09-13 03:30:17 -07:00
relrelb 38a2650c0e chore: Use Value into() in more places 2021-06-24 01:11:16 -07:00
relrelb 95c30b85e1 avm1: Extract ArrayObject 2021-06-22 10:43:10 -07:00
relrelb 9c5b9b7072 avm1: Rewrite TObject array methods 2021-06-13 10:37:15 -07:00
David Wendt 7f4a99ca60 core: Add a `root_clip` method for `Stage` and make everything grabbing depth 0 off the stage use it 2021-04-26 01:15:42 -07:00
David Wendt 6bf3206d95 core: Replace `context.levels` with a root stage 2021-04-26 01:15:42 -07:00
Aaron Hill 6050dd8204
Replace most manual `Collect` impls with `#[derive(Collect)]`
* Replace most unsafe impls with Collect.
 * Switch to local gc-arena fork.
2021-02-17 18:38:55 -08:00
Brian Gontowski 31dd2729e2 web: Add an onFSCommand callback into JavaScript 2021-01-31 18:03:31 -08:00
Nathan Adams a49e8d8587 web: Implement two-way communication with ExternalInterface 2020-09-03 18:17:44 -07:00
Nathan Adams 687c912067 core: Allow for reentry from ExternalInterface methods 2020-09-03 18:17:44 -07:00
Nathan Adams 32de953822 core: Allow passing arguments and returning values to/from ExternalInterface 2020-09-03 18:17:44 -07:00
Nathan Adams e1b3ac79d6 core: Add ability to call out to ExternalInterfaceProviders 2020-09-03 18:17:44 -07:00
Nathan Adams 502ea98ed4 core: Add ability to call in to ExternalInterface callbacks from outside of the player (+ test) 2020-09-03 18:17:44 -07:00
Nathan Adams 3784f411b4 core: Add ExternalInterface::addCallback 2020-09-03 18:17:44 -07:00
Nathan Adams 8f11141426 core: Add initial ExternalInterface structs 2020-09-03 18:17:44 -07:00