Commit Graph

1775 Commits

Author SHA1 Message Date
CUB3D 91d5e0f74b core: Update tests 2020-09-07 13:14:48 -07:00
CUB3D 136a5664b0 core: Pass the correct this for CallFunction when in a with scope
fixes #805, #945, #1018
2020-09-07 13:14:48 -07:00
Mike Welsh a18e80baf2 chore: Fix clippy lints 2020-09-07 12:18:41 -07:00
dependabot-preview[bot] 08f1299595 build(deps): bump syn from 1.0.39 to 1.0.40
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.39 to 1.0.40.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.39...1.0.40)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-07 11:14:14 -07:00
dependabot-preview[bot] 07a6075765 build(deps): bump indexmap from 1.5.2 to 1.6.0
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.5.2...1.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-07 11:13:54 -07:00
David Wendt 35b589b2ac avm2: `in` should only ever query non-namespaced/public properties. 2020-09-07 11:07:07 -07:00
David Wendt 3b5411547a avm2: Implement `in` 2020-09-07 11:07:07 -07:00
David Wendt 11b8354905 avm2: `resolve_any` should resolve prototype properties. 2020-09-07 11:07:07 -07:00
Mike Welsh 64679e8796 avm1: typeof button/text should be object (fix #1110) 2020-09-04 11:33:40 -07:00
Nathan Adams b2dc564628 avm1: Fix String.lastIndexOf(undefined) 2020-09-04 11:32:16 -07:00
Nathan Adams ea7a9758c4 avm1: Fix String.indexOf(undefined) 2020-09-04 11:32:16 -07:00
Mike Welsh 86ab300ee8 core: Call post_instantiate on initial empty root (fix #946)
The `fake_root` did not have an object, which could cause the
player to panic if the SWF was not completely loaded when playing.
Calling `post_instantiate` ensures that this dummy root has an
object.
2020-09-04 11:31:04 -07:00
Mike Welsh 3a813f1f15 tests: Test for #1104 2020-09-03 19:09:48 -07:00
Mike Welsh 5ea06b0ce6 swf: Use Option for more PlaceObject parameters
There is a difference between empty/default (change value to default)
and none (don't modify), so make this explicit for some PlaceObject
parameters where it wasn't.

Fixes #1104.
2020-09-03 19:09:48 -07:00
Mike Welsh 151b13a424 avm1: ExternalInterface properties are read only 2020-09-03 18:17:44 -07:00
Nathan Adams b5531a48d0 web: Allow reentrant ExternalInterface callbacks 2020-09-03 18:17:44 -07: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 169c61bf96 tests: Added ability for tests to have a before_start and before_end, and added basic ExternalInterface test that uses it 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 b66e9f8d16 avm1: Add ExternalInterface with only 'available' property right now 2020-09-03 18:17:44 -07:00
Nathan Adams 8f11141426 core: Add initial ExternalInterface structs 2020-09-03 18:17:44 -07:00
Nathan Adams c5ac707fb5 avm1: Iterating xmlnode attributes should list every attribute 2020-09-03 17:03:43 -07:00
Nathan Adams bcb64b9a62 avm1: Fix calling Function() as a function - fixes #1074 2020-09-03 17:01:20 -07:00
Nathan Adams 40cdb84656 tests: Add test for avm1 Function(foo) 2020-09-03 17:01:20 -07:00
Mike Welsh ce2b360ab7 core: Provide default impl for DisplayObject:hit_test_bounds 2020-09-02 17:51:55 -07:00
Mike Welsh b0c9795cad core: Graphic::from_swf_tag takes ownership of Shape 2020-09-02 17:51:55 -07:00
Mike Welsh f2f70cc882 core: Mouse picking for buttons uses shape hit tests 2020-09-02 17:51:55 -07:00
Mike Welsh d7a186b2cd avm1: Implement shape hit testing 2020-09-02 17:51:55 -07:00
Mike Welsh 2da3c0d319 tests: Add hitTest shapeflag test 2020-09-02 17:51:55 -07:00
Nathan Adams ec407a9514 avm1: Don't blanket impl From<i64> for Value, convert it explicitly where we know it's okay 2020-09-02 17:12:31 -07:00
Nathan Adams 0b5713557b desktop: Implement LocaleBackend for desktop 2020-09-02 17:12:31 -07:00
Nathan Adams f50b29151c avm1: If a NaN is provided to new Date(timestamp), fail immediately 2020-09-02 17:12:31 -07:00
Nathan Adams 9dfc20e1ba avm1: Implement Date.UTC 2020-09-02 17:12:31 -07:00
Nathan Adams 86eb6f2e50 avm1: Implement Date - #249 2020-09-02 17:12:31 -07:00
Nathan Adams 3d30ec67e2 test: Add more cases to registerClass tests 2020-09-02 15:18:59 -07:00
Nathan Adams 2178beec87 core: When constructing objects for DisplayObjects, make sure frames are run at the right moment 2020-09-02 15:18:59 -07:00
Mike Welsh 537cca7c38 tests: Add test for #1086 2020-09-02 13:25:53 -07:00
Mike Welsh bc08971066 core: Return version from MovieClip::swf_version (fix #1086)
MovieClip was not returning the proper SWF version, causing it to
default to the newest SWF version in some cases when it shouldn't.
2020-09-02 13:25:53 -07:00
dependabot-preview[bot] 03dcdcd494 build(deps): bump indexmap from 1.5.1 to 1.5.2
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.5.1...1.5.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-09-02 12:39:18 -07:00
CUB3D e95c1ff758 core: Make blurX and blurY floating point 2020-09-02 10:59:00 -07:00
CUB3D 143ba03754 core: Fix clippy lints and format 2020-09-02 10:59:00 -07:00
CUB3D a2c151677b core: Add blurFilter and test 2020-09-02 10:59:00 -07:00
CUB3D d1ad095bad core: Add tests for bitmap_filter 2020-09-02 10:59:00 -07:00
CUB3D 34f485ca21 core: Add basic flash.filters.(BlurFilter|BitmapFilter) 2020-09-02 10:59:00 -07:00
Nathan Adams cb2461920b core: HTTP request values need to preserve order 2020-08-28 11:53:32 -07:00
dependabot-preview[bot] 4137a1cac0 build(deps): bump minimp3 from 0.4.0 to 0.5.0
Bumps [minimp3](https://github.com/germangb/minimp3-rs) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/germangb/minimp3-rs/releases)
- [Commits](https://github.com/germangb/minimp3-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-27 13:20:14 -07:00
dependabot-preview[bot] 9db07eb997 build(deps): bump minimp3 from 0.3.5 to 0.4.0
Bumps [minimp3](https://github.com/germangb/minimp3-rs) from 0.3.5 to 0.4.0.
- [Release notes](https://github.com/germangb/minimp3-rs/releases)
- [Commits](https://github.com/germangb/minimp3-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-26 09:57:40 -07:00
Mike Welsh f55bac2014 text: HTML tags and attributes are case insensitive (fix #1021)
Use eq_ignore_ascii_case when parsing HTML tags. Different versions
of Flash may export HTML tags with different cases, so this will
work a little better; however, we'll need a true HTML parser to
handle this robustly (for opening and closing tags with different
cases, for example).
2020-08-24 11:27:14 -07:00
Mike Welsh febada8a8e text: Fix duplicated characters when parsing HTML entities (fix #1026) 2020-08-24 11:27:14 -07:00
Mike Welsh e8178c35a3 core: Add MouseWheel player event 2020-08-23 13:38:59 -07:00
kmeisthax 559bc05b6a
avm2: Implement avm2 math opcodes (merge #1037)
* Implement `add`, with tests.

* Implement `add_i`.

There's no test, because for whatever reason, I can't figure out how to emit this from Animate CC 2020.

* avm2: Implement `bitand` with tests.

* Implement `bitnot` with tests.

* Implement `bitor` with tests.

* avm2: Implement `bitxor`

* avm2: Implement `declocal`, `declocal_i`, `decrement`, and `decrement_i`.

* tests: `swf_approx` tests should be allowed to print NaNs.

* avm2: Implement `divide`.

* avm2: Implement `inclocal`, `inclocal_i`, `increment`, and `increment_i`.

* avm2: Implement `lshift`.

* Implement `modulo`.

* avm2: Implement `multiply` and `multiply_i` (no tests for the latter)

* avm2: Implement `negate` and `negate_i` (no tests for the latter)

* avm2: Implement `rshift`

* avm2: Implement `subtract` and `subtract_i` (the latter without tests)

* avm2: Implement `urshift`.
2020-08-23 13:38:38 -07:00
Mike Welsh ba05894901 avm1: Don't mutably borrow self in TObject 2020-08-23 02:19:53 -07:00
Mike Welsh 2a84d924bb chore: Don't mutably borrow self in TDisplayObject 2020-08-22 11:56:19 -07:00
dependabot-preview[bot] 5d2ba7fee6 build(deps): bump syn from 1.0.38 to 1.0.39
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.38 to 1.0.39.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.38...1.0.39)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-21 12:54:02 -07:00
Mike Welsh 06b6d14367 avm1: Fix removeMovieClip depth range
removeMovieClip should only function on objects within a certain
depth range, usually to prevent removing timeline clips. However,
this wasn't working properly in some cases because the depth was
being biased incorrectly (removeMovieClip never takes a depth
parameter, so we should not bias the depth).
2020-08-21 00:55:35 -07:00
Mike Welsh 528b52ac7c tests: Activate unused remove_movie_clip test 2020-08-21 00:55:35 -07:00
Mike Welsh 1e6a053c56 avm1: Implement TargetPath 2020-08-20 18:14:01 -07:00
Mike Welsh bbc5e01009 tests: Add test for targetPath action 2020-08-20 18:14:01 -07:00
Mike Welsh e9f9cda34d tests: Rename target_path test to string_path 2020-08-20 18:14:01 -07:00
Mike Welsh b8f5a405b9 tests: Add test for flash.geom.Transform 2020-08-20 17:29:04 -07:00
Mike Welsh ca3ed34c2c avm1: Implement flash.geom.Transform 2020-08-20 17:29:04 -07:00
Mike Welsh 0a81dae7bb avm1: toString for display objects 2020-08-18 01:18:15 -07:00
Mike Welsh cefc0ce5c1 core: Add button children to execution list
Children of buttons were not getting linked up into the execution
list, which would cause certain methods to be incorrect (such as
button._width).
2020-08-18 01:18:15 -07:00
Mike Welsh d2c49c0f33 core: Remove some mut from TDisplayObject methods 2020-08-18 01:18:15 -07:00
Mike Welsh 544c1becc2 tests: Add test for button children 2020-08-18 01:18:15 -07:00
Mike Welsh 59ebd0167e core: Fix priority of conflicting instance names 2020-08-18 01:18:15 -07:00
Mike Welsh b5c7e1dab0 tests: Add test for conflicting instance names 2020-08-18 01:18:15 -07:00
Mike Welsh 13b4b6bbbb chore: Fix unused variable warning in url_from_relative_path 2020-08-16 18:44:57 -07:00
Floens 95acc14190 avm1: fix array unshift
update array_trivial test for it
2020-08-16 04:27:09 -07:00
Mike Welsh f782ea8020
avm2: AVM2 built-in class suport (merge #802)
Initial support for defining built-ins in AVM2
2020-08-16 03:45:02 -07:00
David Wendt 4c824fcefe Rename `trait.rs` to `traits.rs` to avoid the use of reserved keyword syntax. 2020-08-14 21:20:41 -04:00
David Wendt 7b7f0b20e6 Consolidate all of our copied `CollectWrapper`s. 2020-08-14 20:52:09 -04:00
Albert Safin e03373bceb avm1: parseInt 2020-08-13 00:40:20 -07:00
Mike Welsh cbd448522a chore: Allow unknown clippy lints
same_item_push was added on nightly, but is currently throwing
a false negative. I added an allow for it, but this causes a
warning on stable for an unknown lints, so allow unknown lints for
now.
2020-08-12 23:51:12 -07:00
Mike Welsh 6c89869210 chore: Fix clippy lints 2020-08-12 19:04:14 -07:00
dependabot-preview[bot] 9b6dd45439 build(deps): bump smallvec from 1.4.1 to 1.4.2
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.4.1...v1.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-12 11:13:33 -07:00
David Wendt 825eb34c67 avm1: `Button` should not hold write locks on itself when instantiating children.
This fixes a bug where a nested textfield within a button with variable linkages would panic in Ruffle.
2020-08-12 11:08:27 -07:00
David Wendt 354b194b69 avm1: Add test for nested text fields in buttons. 2020-08-12 11:08:27 -07:00
David Wendt 32aad6176b `FunctionObject::from_builtin_constr` should pull the scope and class off of it's given prototype and copy it onto the constructor function it returns. 2020-08-11 00:04:13 -04:00
David Wendt 11ddccfa6a Remove the two-step initialization process and construct an ES4 class for `Object`, `Function`, and `Class`.
This has some particularly annoying consequences for initialization order: notably, we can't actually create any ES4 classes using the standard machinery until after the three objects I just mentioned get created. Ergo, we have to create them through lower-level means, handing prototypes around, and then initialize AVM2's system prototypes list for it.

When we start adding more system prototypes, we'll also have to fill the extras with blank objects and then slot them in as we create them.
2020-08-11 00:02:12 -04:00
David Wendt 16d8c85d20 Load player globals as soon as possible.
We're about to massively change the initialization process, and we really don't want to create another situation where the player can get caught with it's pants down.
2020-08-10 23:35:37 -04:00
David Wendt a8e267ed16 Allow system prototypes to be initialized after the fact. 2020-08-10 23:35:37 -04:00
David Wendt b1bcceaa78 Allow accessing the `Class` off of a constructor or prototype that references it. 2020-08-10 23:35:33 -04:00
David Wendt 22ec96b85e `install_trait` and `install_foreign_trait` should return the value of the thing they installed. 2020-08-10 23:23:35 -04:00
David Wendt df95482eb1 Allow setting `slot_id` or `disp_id` (depending on kind). 2020-08-10 23:23:34 -04:00
David Wendt 4ed5050f56 Add function to change trait attributes. 2020-08-10 23:23:34 -04:00
David Wendt a5b62e833e Add trait attributes, similar to that of class attributes 2020-08-10 23:23:31 -04:00
David Wendt 60d42fa558 Allow creating slot/const traits. 2020-08-10 23:19:22 -04:00
David Wendt 3ca8dfd21a Allow constructing traits for getters, setters, and unbound free functions. 2020-08-10 23:19:22 -04:00
David Wendt d366ceab0e Allow setting the protected namespace of a builtin class. 2020-08-10 23:19:21 -04:00
David Wendt 9dc6cbe1ce Allow creating builtin traits from methods. 2020-08-10 23:19:21 -04:00
David Wendt 5e932bcb75 Allow implementing interfaces in built-in classes. 2020-08-10 23:19:20 -04:00
David Wendt 94d5170277 When manually instantiating classes for globals, make sure that the classes get the global scope object when instantiated. 2020-08-10 23:19:15 -04:00
David Wendt 3585cf983b Convert our stub implementations of all non-ECMA classes into `Class`es.
This was surprisingly tricky - due to the need to look up superclasses, class trait instantiation requires an active `Activation` and `UpdateContext`. We can't get those during VM instance creation, since the player needs the VM first before it can give it a context to work with. Ergo, we have to tear the global scope initialization in two. At the first possible moment, the player calls a new `load_player_globals` method that initializes all class traits in global scope.
2020-08-10 23:16:07 -04:00
David Wendt 6f284f60eb Allow constructing a trait from a class. 2020-08-10 23:09:16 -04:00
David Wendt b0b6cec117 Allow expanding a `QName` into a `Multiname` that selects exactly the `QName` and no more. 2020-08-10 23:09:15 -04:00