Commit Graph

1491 Commits

Author SHA1 Message Date
Mike Welsh 794dc69809 avm1: Implement isFinite 2020-07-23 22:58:58 -07:00
Nathan Adams 7f7281493f core: Allow toggling avm_debug output on and off with ctrl+alt+d, defaults to off 2020-07-23 19:14:32 -07:00
Mike Welsh efa059ff8d tests: Add test for LoadVars 2020-07-23 03:00:19 -07:00
Mike Welsh 1709e76409 avm1: Implement LoadVars 2020-07-23 03:00:19 -07:00
Mike Welsh 74cb8609c1 avm1: Support loading into _level in GetURL2
Calling loadMovieNum with a variable parameter compiles into a
GetURL2 call with a `_level` window target parameter. Previously
this triggered Ruffle to try to navigate to the SWF. Now it
properly loads the SWF inside the current movie.
2020-07-23 02:08:48 -07:00
Nathan Adams f0980301da avm1: Implement arguments.callee 2020-07-22 15:57:45 -07:00
Nathan Adams 4a56cb1062 avm1: Make virtual properties store Object instead of Executable, so we can refer to the callee 2020-07-22 15:57:45 -07:00
Nathan Adams f4ab57d6e0 avm1: Make property watchers take Object, not Executable, so we can track the callee 2020-07-22 15:57:45 -07:00
Nathan Adams 9ae10b6387 avm1: Made AvmString debug actually show contents of the string 2020-07-22 13:23:57 -07:00
Nathan Adams 3b2b7c226c avm1: Fix gc unsoundness with missing collects in SystemPrototypes 2020-07-21 09:43:07 -07:00
Nathan Adams 0e0be34e17 avm1: Fix compile error when using avm_debug flag 2020-07-21 09:42:41 -07:00
Nathan Adams d5deeee1b7 avm1: Properly implement the arguments object, it's an array 2020-07-21 07:49:00 -07:00
dependabot-preview[bot] aa966fbfb6 build(deps): bump syn from 1.0.34 to 1.0.35
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.34 to 1.0.35.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.34...1.0.35)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-20 14:24:56 -07:00
Mike Welsh 1a5d7fe452
avm2: Initial AVM2 interpreter (merge #404)
Initial work on the AVM2 interpreter.
2020-07-19 19:59:05 -07:00
David Wendt 7adabc8166 Use `unwrap_or_default` 2020-07-18 17:28:07 -04:00
David Wendt 44b924d7b4 `Script` should not hold write locks when probing it's internal caches. 2020-07-18 17:26:11 -04:00
Mike Welsh 034c125b80 core: Support radial gradients in morph shapes
Radial gradients were not accounted for in morph shapes.
Clean up the interpolation code and add support for radials.
Fixes #591.
2020-07-18 14:12:04 -07:00
David Wendt 575a9b091a Use FnvHashMap for the translation unit pools. 2020-07-18 17:02:52 -04:00
David Wendt 262bb148f1 Rename `a2me` to `entry` (or `method` in one case where it lets me simplify a struct declaration) 2020-07-18 17:02:32 -04:00
David Wendt c415190376 Zero-index multinames should generate a validation error in `QName::from_abc_multiname`. 2020-07-18 16:48:10 -04:00
David Wendt dc962f2abd Add AVM2 equivalent of `PropertyMap` for further expansion. 2020-07-18 16:41:35 -04:00
David Wendt 37b6b89d26 Add a stub AVM2 string representation to allow for both VMs' strings to diverge. 2020-07-18 16:20:58 -04:00
David Wendt ccacc540bf Remove dead code on all now-in-use structs and methods. 2020-07-18 16:12:24 -04:00
dependabot-preview[bot] 0bd7f07649 build(deps): bump png from 0.16.6 to 0.16.7
Bumps [png](https://github.com/image-rs/image-png) from 0.16.6 to 0.16.7.
- [Release notes](https://github.com/image-rs/image-png/releases)
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/compare/v0.16.6...v0.16.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-18 12:36:46 -07:00
Mike Welsh ae7db80ea3 avm1: Move getURL to MovieClip.prototype (fix #804)
For example, _root.getURL should work.
2020-07-18 01:03:47 -07:00
dependabot-preview[bot] ee2222a425 build(deps): bump indexmap from 1.4.0 to 1.5.0
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.4.0...1.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-17 20:51:05 -07:00
Mike Welsh 8ecae5a87f avm1: duplicateMovieClip copies clip events
Clip events should be copied from the source clip to the newly
created clip. Fixes objects remaining onscreen in #815.
2020-07-17 20:49:05 -07:00
Mike Welsh 8c1ec01d75 tests: Test clip events copying in duplicateMovieClip
duplicateMovieClip should also copy any clip events on the source
clip to the newly created movie clip.
2020-07-17 20:49:05 -07:00
Mike Welsh 7c52a1bcc4 avm1: Accept path strings in ActionCall (fix #832) 2020-07-14 23:34:21 -07:00
Mike Welsh b43fdca4ad avm1: resolve_text_field_variable -> resolve_variable_path 2020-07-14 23:34:21 -07:00
Mike Welsh f9b1c586d1 tests: Add test for paths in ActionCall 2020-07-14 23:34:21 -07:00
David Wendt e354c53075 Remove any remaining uses of `abc_ref`.
Holding a `Ref` on a garbage-collected object inherently extends any borrow locks on that object. Since ABC files are references already, taking a `Ref` to them only helps to skip the refcount update. This is less useful than expected: in most situations, using `abc_ref` causes double-borrow panics. The few methods that can use it are going to be fragile in the face of future refactors, so I'm nipping the problem in the bud now.
2020-07-14 20:14:23 -04:00
David Wendt f4c5075086 Run all string constant retrieval through the `TranslationUnit`, preventing us from making multiple copies of the same string.
For good measure, most of the other methods in `value` for retrieving pool primitives now also use `TranslationUnit` instead of `AbcFile`. This is the result of a handful of cascading changes throughout the project, and itself caused a few more.
2020-07-14 20:05:25 -04:00
David Wendt 70e9e7e9e9 Add support for cached/interned pool strings in the `TranslationUnit`. 2020-07-13 23:42:07 -04:00
David Wendt e1b9b823fc Remove `abc_string` and replace it with `abc_string_copy`. All code that pulls strings from the ABC file now uses `AvmString`s. 2020-07-13 23:41:46 -04:00
David Wendt 61a3ff8ae6 Replace `String` or `&str` references with `AvmString` everywhere in the AVM2 runtime. 2020-07-13 22:21:18 -04:00
David Wendt 2021cec9d3 Impl `Copy`, `Eq`, `PartialOrd`, `Ord`, and `Hash` for `AvmString`. 2020-07-13 22:09:34 -04:00
David Wendt 508fcd6e9e `pool_string` should return a `Ref<str>` just like `value::abc_string`. 2020-07-13 17:45:12 -04:00
David Wendt a406bdada2 Don't attempt to log debugging information if we're not in a debug build. 2020-07-13 17:45:12 -04:00
David Wendt ae26615bb4 `coerce_string` may return a static string, which we shouldn't clone. 2020-07-13 17:45:12 -04:00
David Wendt f0c633fe81 Allow borrowing string values from an ABC file instead of cloning everything. 2020-07-13 17:45:11 -04:00
David Wendt 64e5b46259 Add tests for `instanceof` and `is` operators. 2020-07-13 17:45:10 -04:00
David Wendt 39a4566f20 Instances should be listed as their prototypes (empty as they are) 2020-07-13 17:45:10 -04:00
David Wendt c917b3d411 Implement `istype`, `istypelate`, and `instanceof`. 2020-07-13 17:45:10 -04:00
David Wendt a0cb052795 Add `is_instance_of` trait method to `TObject` 2020-07-13 17:45:09 -04:00
David Wendt 3fae8b3832 Read the interface list when instantiating classes, resolve them, and stick them in the prototype for later use. 2020-07-13 17:45:09 -04:00
David Wendt cce68dbc21 Add trait methods for getting and setting the interfaces list. 2020-07-13 17:45:08 -04:00
David Wendt 563a515189 Add a test for loading interfaces into the AVM2.
This test will fail if the AVM2 implementation does not support bodyless methods or bare classes properly.
2020-07-13 17:45:07 -04:00
David Wendt 8f2d3315f3 Allow the construction of classes with no base class.
This is primarily used for interfaces, in case you can't guess by the previous commit.
2020-07-13 17:45:07 -04:00
David Wendt 5d89d4ed85 Allow methods to not hold a body.
Interface methods are specifically not allowed to be called: as a result, they don't get a method body. Existing code assumed a 1:1 relationship between methods and bodies, which causes spurious errors.
2020-07-13 17:45:07 -04:00