Commit Graph

1431 Commits

Author SHA1 Message Date
David Wendt bb879870ec Add test for the constructor property on v6 and v7 SWFs 2020-04-25 13:25:21 -04:00
Nathan Adams b3322acc8c tests: Copy as2_super_and_this test for manual prototype setting, used by mx (currently broken) 2020-04-25 13:25:20 -04:00
David Wendt aaa6f481ac Add a v6 version of the super-and-this test, which is exactly the same source compiled to SWF version 6. 2020-04-25 13:25:20 -04:00
David Wendt 17d96a0fa6 Constructing a new object sets `constructor` on that object for SWFv6 and lower. 2020-04-25 13:25:20 -04:00
David Wendt b8fd1eac9c Invoke virtual setters defined in the prototype chain.
This is accomplished via two new `TObject` methods: `has_own_virtual` and `call_setter`. If an object does not contain it's own version of a property, it will first crawl the prototype chain to see if there is an overwritable virtual. If so, it will invoke that prototype's setter.

A bit of borrow finangling was required to do this; `super` now no longer caches it's proto and constr values and instead dynamically constructs them. This also means it can't be downcasted to `Executable` anymore.

With this commit, virtual setters and super-setters now work correctly.
2020-04-25 13:25:19 -04:00
David Wendt 35197f889f `Property.set` should return a `ReturnValue` as it can potentially execute AVM code 2020-04-25 13:25:19 -04:00
David Wendt e76ba4de87 Method calls on `super` objects should substitute the child object instead of itself as `this`. 2020-04-25 13:25:19 -04:00
David Wendt 869cbd17da Extend `as2_super_and_this` to cover accessing object properties in super-methods, super-getters, and super-setters. 2020-04-25 13:25:18 -04:00
David Wendt 9c5cd79e2c Refactor how `SuperObject` works to use `base_proto` and avoid handing copies of itself as `this`.
This allows supercalled functions to properly read and mutate the object they were called on.
2020-04-25 13:25:18 -04:00
David Wendt f3b3db51cb Alter AVM1 to keep track of each function call's *base prototype*: the object from which a particular function was retrieved from.
A base prototype is only applicable in cases where a method is being called as a property on an object. Bare function calls, `apply`/`call` calls, and so on do not generate a base prototype.

We also add a convenience method, `call_method`, to all objects. This method automatically calculates the correct base prototype for a method call on an object, which is the only operation that should generate base prototypes.
2020-04-25 13:25:18 -04:00
David Wendt 15a19f4cf8 Add test from @Dinnerbone that checks to make sure super-called functions can still initialize the object they are a part of. 2020-04-25 13:25:17 -04:00
dependabot-preview[bot] f7cf943740 build(deps-dev): bump @wasm-tool/wasm-pack-plugin in /web/selfhosted
Bumps [@wasm-tool/wasm-pack-plugin](https://github.com/wasm-tool/wasm-pack-plugin) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/wasm-tool/wasm-pack-plugin/releases)
- [Commits](https://github.com/wasm-tool/wasm-pack-plugin/compare/v1.3.0...v1.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-25 11:33:38 +00:00
dependabot-preview[bot] 6bab890760 build(deps): bump lyon from 0.15.6 to 0.15.7
Bumps [lyon](https://github.com/nical/lyon) from 0.15.6 to 0.15.7.
- [Release notes](https://github.com/nical/lyon/releases)
- [Changelog](https://github.com/nical/lyon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nical/lyon/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-25 10:33:52 +00:00
dependabot-preview[bot] 169fb6a1a3 build(deps-dev): bump webpack from 4.42.1 to 4.43.0 in /web/selfhosted
Bumps [webpack](https://github.com/webpack/webpack) from 4.42.1 to 4.43.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.42.1...v4.43.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-25 10:19:35 +00:00
dependabot-preview[bot] c5a8402eae build(deps): bump syn from 1.0.17 to 1.0.18
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.17 to 1.0.18.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.17...1.0.18)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-25 10:19:18 +00:00
Mike Welsh fd114959f9 core: Fix regressions from init order changes in #498
Revert to the old action queue method of popping off actions in a
loop, as new actions can be queued while iterating. Store proto
changes in a separate queue to maintain the high priority behavior.
2020-04-25 03:06:54 -07:00
Mike Welsh bad34c4d8f tests: Fix tests for regressions caused by #498
Changes to the action queue caused actions queued during other
actions to run too late. These regressions weren't caught by the
tests because many of the goto tests ran for more frames than was
necessary, allowing the late actions to still run.
2020-04-25 03:06:54 -07:00
Mike Welsh c1dc69c6b7 chore: rustfmt 2020-04-24 22:16:16 -07:00
Mike Welsh 650efad4b2 chore: Fix new clippy lints for Rust 1.43 2020-04-24 21:39:49 -07:00
dependabot-preview[bot] 24a26541a3 build(deps): bump smallvec from 1.3.0 to 1.4.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.3.0...v1.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-24 12:20:39 +00:00
dependabot-preview[bot] 62ab2ad787 build(deps-dev): bump @wasm-tool/wasm-pack-plugin in /web/selfhosted
Bumps [@wasm-tool/wasm-pack-plugin](https://github.com/wasm-tool/wasm-pack-plugin) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/wasm-tool/wasm-pack-plugin/releases)
- [Commits](https://github.com/wasm-tool/wasm-pack-plugin/compare/v1.2.0...v1.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-22 20:22:39 +00:00
dependabot-preview[bot] c08a55c7fc build(deps): bump structopt from 0.3.13 to 0.3.14
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.13 to 0.3.14.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.13...v0.3.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-22 19:25:07 +00:00
dependabot-preview[bot] 307d27709f build(deps): bump console_log from 0.1.2 to 0.2.0
Bumps [console_log](https://github.com/iamcodemaker/console_log) from 0.1.2 to 0.2.0.
- [Release notes](https://github.com/iamcodemaker/console_log/releases)
- [Commits](https://github.com/iamcodemaker/console_log/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-21 12:59:40 +00:00
Nathan Adams b43d0c2430 core: Pass SwfMovies along to empty movie clips 2020-04-21 05:49:25 -07:00
Nathan Adams a673e7108d tests: Add test for movieclip.createEmptyMovieClip().attachMovie()` 2020-04-21 05:49:25 -07:00
Nathan Adams 8b34fbdd81 chore: Removed debug code from a test 2020-04-21 05:48:17 -07:00
dependabot-preview[bot] 0dfe0d76c1 build(deps): bump png from 0.16.2 to 0.16.3
Bumps [png](https://github.com/image-rs/image-png) from 0.16.2 to 0.16.3.
- [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/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-19 21:32:03 +00:00
dependabot-preview[bot] 8fd497461c build(deps): bump image from 0.23.3 to 0.23.4
Bumps [image](https://github.com/image-rs/image) from 0.23.3 to 0.23.4.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.23.3...v0.23.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-19 21:31:31 +00:00
Nathan Adams 330e6b40f0 core: post_instantiation should happen after properties are set, but before first frame or actions 2020-04-17 23:48:58 -07:00
Nathan Adams 9318290336 core: Execute init actions immediately, do not queue them up
Clip initializers can and will influence how the next clips are loaded, and must execute before that

This fixes #418
2020-04-17 23:48:58 -07:00
Nathan Adams fe6b79a9b7 chore: Make avm1 accessible to MovieClip::preload 2020-04-17 23:48:58 -07:00
Nathan Adams 46d31548b0 chore: Move MovieClipData::do_init_action to MovieClip::do_init_action
No functional changes, just replaces `self` with `self.0.read()` and removed `self_display_object` argument
2020-04-17 23:48:58 -07:00
Nathan Adams c0d1dec7dd chore: Move MovieClipData::preload to MovieClip::preload
No functional changes, just replaced `self` with `self.0.read/write`.
2020-04-17 23:48:58 -07:00
Nathan Adams 601fcbfebd core: Queue up changes of movieclip prototypes, don't execute it immediately (but at a higher priority than normal actions) 2020-04-17 23:48:58 -07:00
Nathan Adams 6b48e77b61 avm1: Add TObject::set_proto 2020-04-17 23:48:58 -07:00
Nathan Adams 6316d7e0b3 tests: Add (currently failing) test for init order when combined with register_class 2020-04-17 23:48:58 -07:00
Nathan Adams d0fd26a89c avm1: Fix panic with [].unshift(x) 2020-04-17 21:17:13 -07:00
dependabot-preview[bot] 0cac118b59 build(deps): bump winit from 0.22.0 to 0.22.1
Bumps [winit](https://github.com/rust-windowing/winit) from 0.22.0 to 0.22.1.
- [Release notes](https://github.com/rust-windowing/winit/releases)
- [Changelog](https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-windowing/winit/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-17 22:48:04 +00:00
Nathan Adams bf639e1802 avm1: Don't crash when enumerating non-objects, it's a silent fail 2020-04-15 05:26:09 -07:00
Mike Welsh ddfd84ecdd web: Stop playing sounds when an instance is destroyed 2020-04-13 04:57:10 -07:00
Sean-Thomas 4d91a202e1 web/demo: Add dropdown to select sample SWF
- replaced static polyfill embed on web demo with JS API code.
- added swf_lib JSON file for sample SWFs.
- added console logs for when a Ruffle instance is created or destroyed in ruffle-player.js.
- more minor styling changes to the web demo index page.
2020-04-13 04:55:57 -07:00
dependabot-preview[bot] 6d837d69d4 build(deps): bump svg from 0.7.1 to 0.7.2
Bumps [svg](https://github.com/bodoni/svg) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/bodoni/svg/releases)
- [Commits](https://github.com/bodoni/svg/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-13 11:15:12 +00:00
Mike Welsh b7d464f367 chore: Bump enumset to 1.0.0 2020-04-13 04:14:29 -07:00
dependabot-preview[bot] ecb15eac04 build(deps): bump structopt from 0.3.12 to 0.3.13
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.12 to 0.3.13.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-09 23:49:59 +00:00
dependabot-preview[bot] 2146c42863 build(deps): bump smallvec from 1.2.0 to 1.3.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.2.0...v1.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-09 21:19:11 +00:00
dependabot-preview[bot] bb71aa677f build(deps): bump image from 0.23.2 to 0.23.3
Bumps [image](https://github.com/image-rs/image) from 0.23.2 to 0.23.3.
- [Release notes](https://github.com/image-rs/image/releases)
- [Changelog](https://github.com/image-rs/image/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image/compare/v0.23.2...v0.23.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-09 21:12:00 +00:00
dependabot-preview[bot] c20f3736ca build(deps): bump png from 0.16.1 to 0.16.2
Bumps [png](https://github.com/image-rs/image-png) from 0.16.1 to 0.16.2.
- [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.1...v0.16.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-04 07:03:37 +00:00
dependabot-preview[bot] f87704742f build(deps): bump serde from 1.0.105 to 1.0.106
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.105 to 1.0.106.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.105...v1.0.106)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-04 07:01:10 +00:00
Mike Welsh 47e936fcc2 tests: Add tests for Array.sort 2020-04-01 18:46:12 -07:00
Mike Welsh bd0d2031bc avm1: Implement Array.sort and constants 2020-04-01 18:46:12 -07:00