Commit Graph

851 Commits

Author SHA1 Message Date
Mike Welsh c29b042f5e avm1: Get child clip instances in StageObject
Add the logic to get children display objects as properties in
`StageObject`.
2019-12-15 08:54:26 -08:00
Mike Welsh 783ede6f79 core: Add DisplayObject::path 2019-12-15 08:54:26 -08:00
Mike Welsh 73604a891e core: Move get_child_by_name to DisplayObject 2019-12-15 08:54:26 -08:00
David Wendt 724f845037 Remove the `DisplayNode` slot from `ScriptObject`, since all display node objects should be `StageObject`s now. 2019-12-15 08:54:26 -08:00
David Wendt fa9329df68 Instantiate all MovieClips as StageObjects. 2019-12-15 08:54:26 -08:00
David Wendt 3df6c7eeef Always post-instantiate display objects when running tests. 2019-12-15 08:54:26 -08:00
David Wendt 73655c0c88 Add a separate native object type for objects tied to the stage. 2019-12-15 08:54:26 -08:00
Mike Welsh f0c6b2d8d8 core: Remove this from Object::get/set 2019-12-15 08:54:26 -08:00
dependabot-preview[bot] f58827f3de build(deps): bump cpal from 0.10.0 to 0.11.0
Bumps [cpal](https://github.com/rustaudio/cpal) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/rustaudio/cpal/releases)
- [Changelog](https://github.com/RustAudio/cpal/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rustaudio/cpal/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-11 18:31:40 +00:00
Nathan Adams f4fc987c6c chore: Add dependabot for js 2019-12-11 10:21:59 -08:00
dependabot-preview[bot] 251fb01572 build(deps): bump jpeg-decoder from 0.1.17 to 0.1.18
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.17 to 0.1.18.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases)
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/image-rs/jpeg-decoder/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-11 18:21:42 +00:00
Mike Welsh 4edef806b0 docs: Add sponsors link to README 2019-12-10 18:07:51 -08:00
Mike Welsh e5472aab91 avm2: Improve error when reading invalid opcode 2019-12-10 11:26:58 -08:00
Mike Welsh 0f9895cfa5 avm2: Don't parse the opcode stream when parsing ABC 2019-12-10 11:26:58 -08:00
Mike Welsh 1d3137c255
core: Merge #158, Refactor usage of GcCell in DisplayObject/ScriptObject traits 2019-12-10 02:08:22 -08:00
Mike Welsh b59bf40c78 core: Remove this from Object::get/set 2019-12-10 01:36:02 -08:00
Mike Welsh f7822141b7 core: Rename display_node methods to display_object 2019-12-10 01:36:02 -08:00
Mike Welsh 71e4eb87d7 core: Remove as_*_mut methods on DisplayObject/Object 2019-12-10 01:36:02 -08:00
Mike Welsh d7740bc3ad core: Don't touch UpdateContext::active_clip in DisplayObjects
DisplayObject code no longer has to manage
UpdateContext::active_clip before calling out to children, because
each child still has access to its Gc pointer.
2019-12-10 01:36:02 -08:00
Mike Welsh 25b86c14ae core: Move method impls from Button to ButtonData 2019-12-10 01:36:02 -08:00
Mike Welsh 78e65a01df core: Move method impls from MovieClip to MovieClipData 2019-12-10 01:36:01 -08:00
Mike Welsh 12c1bf7cf1 core: Clean up UpdateContext creation
Added Player::mutate_with_update_context, which takes a closure
and passes it an UpdateContext.
2019-12-10 01:36:01 -08:00
Mike Welsh 30ecbd0ecc core: Use enum_trait_object for DisplayObject 2019-12-10 01:36:01 -08:00
Mike Welsh 23ca66a7e3 avm1: Use enum_trait_object for avm1::Object 2019-12-10 01:36:01 -08:00
Mike Welsh b27bc578e0 core: Add enum_trait_object proc macro
The enum_trait_object attribute macro can be used to define an enum where
each variant holds an implementor of a trait. It implements all
methods to forward to the underlying object, as well as `From` impls.

This an aliternative to using trait objects that gets along nicer
with `gc-arena`.
2019-12-10 01:36:01 -08:00
dependabot-preview[bot] 7fce29e006 build(deps): bump winit from 0.20.0-alpha4 to 0.20.0-alpha5
Bumps [winit](https://github.com/rust-windowing/winit) from 0.20.0-alpha4 to 0.20.0-alpha5.
- [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>
2019-12-10 07:25:47 +00:00
Mike Welsh f9841fbaa3 web: Update npm dependencies 2019-12-09 16:16:42 -08:00
dependabot-preview[bot] 86c0fa327b build(deps): bump jpeg-decoder from 0.1.16 to 0.1.17
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.16 to 0.1.17.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases)
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/image-rs/jpeg-decoder/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-09 17:39:42 +00:00
dependabot-preview[bot] a1cf2d3ab8 build(deps): bump png from 0.15.1 to 0.15.2
Bumps [png](https://github.com/image-rs/image-png) from 0.15.1 to 0.15.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.15.1...v0.15.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-04 07:07:57 +00:00
Mike Welsh 29754eace8 web: Avoid `copyToChannel` on Safari
`AudioBuffer.copyToChannel` does not work on Safari, so switch to
using `getChannelData` to fill the audio buffers.

Limitations in wasm-bindgen prevent us from actually modifying the
data returned by `getChannelData` on the Rust side, so import a JS
function to fill the audio buffer (js-src/ruffle-imports.js).
2019-12-03 23:05:42 -08:00
Mike Welsh cbe0f873af tests: Add test for Object.addProperty 2019-12-03 15:01:39 -08:00
Mike Welsh 90b6858bb2 avm1: Fix return value of `Object.addProperty` 2019-12-03 14:59:37 -08:00
Mike Welsh 28364f7d00 avm1: Fix `this` object in GetMember/SetMember 2019-12-03 14:59:01 -08:00
Mike Welsh 1a1cdfa757 desktop: Allow audio creation to fail
Switch to NullAudioBackend if CpalAudioBackend fails to initialize.
(This happens on my laptop which doesn't have an audio device!)
2019-11-30 20:08:34 -08:00
Nathan Adams eb185982cd Add more Number(x) tests, and corrected primitive_as_number to match 2019-11-29 16:07:35 -08:00
Nathan Adams 85b9ffe102 core: Merge both test macros into a generic test_method 2019-11-29 13:12:00 -08:00
Nathan Adams 1f4405189a core: Make math test_std also take in versions 2019-11-29 13:12:00 -08:00
Nathan Adams 999bb128de core: Allow global test_std to test multiple swf versions 2019-11-29 13:12:00 -08:00
Nathan Adams 4c7d37c498 core: Added `avm_debug!` macro 2019-11-29 12:59:45 -08:00
Nathan Adams d1b73582ce core: Add feature `avm_debug` that toggles tracing avm actions and stack history 2019-11-29 12:59:45 -08:00
Mike Welsh d7ec4398b8
core: Merge #114, ECMA abstract comparisons 2019-11-29 12:52:57 -08:00
David Wendt 9ec85c3892 Add tests for SWF6 numerical coercions. 2019-11-28 21:32:10 -05:00
David Wendt f856243247 Primitive coercions should not yield an object just because valueOf is undefined. 2019-11-28 20:53:32 -05:00
David Wendt ec3ac4e5d6 `undefined` coerces to `0.0` on SWF6 2019-11-28 20:53:32 -05:00
David Wendt 89e060be4e Add a regression test for `_global` being a bare object 2019-11-28 20:53:31 -05:00
David Wendt 16259ad74a Calling uncallable values does not actually cause a runtime error in Flash; it just returns null.
This was discovered almost by accident: @Dinnerbone noticed that `_global == null`, and surmised that `valueOf` was the culprit. However, this doesn't really make sense: `_global` is a bare object, so it shouldn't have a `valueOf` (and in practice, it doesn't).

The ultimate cause of such an odd comparison is as such:

1. Flash coerces the `_global` object to a numerical primitive by calling `valueOf`.
2. `_global.valueOf` is undefined. Flash handles calls to any uncallable value by literally just having it return `undefined`. In other words, all values are implicitly callable as empty functions.
3. `undefined` is then compared to `null`. These two values *are* equal under abstract equality (`==`). Hence, `_global == null`.

For comparison, modern ECMAScript engines throw errors on calls to uncallable values; and won't attempt to use an invalid `valueOf` to coerce objects. So none of this applies to, say, standard JavaScript in your browser.
2019-11-28 20:53:31 -05:00
Nathan Adams 68760007fc Lessthan can return `undefined`, not just booleans 2019-11-28 20:53:30 -05:00
Nathan Adams 638231e7fb swf4 doesn't have NaN or Infinity 2019-11-28 20:53:20 -05:00
Nathan Adams 581d0940b2 NaN == NaN without coercion 2019-11-28 20:43:59 -05:00
Nathan Adams f33229a2a1 `_global` == null && `_global` == undefined 2019-11-28 20:43:58 -05:00