Will Brindle
463d0fc352
core: implement isNaN and Number functions. Involves updating to_number function in Value. Note: this varies a little from the ECMA spec such as not allowing spaces in numbers (i.e. ' 5' => NaN). No definitive reference for this but was found experimentally. Same with not supporting 'Infinity'
2019-10-19 10:29:26 +01:00
Will Brindle
38c66b5b8d
core: implement Boolean function
2019-10-19 10:29:26 +01:00
Mike Welsh
b0624a3654
tests: Add define_function2 and register test
2019-10-15 17:20:48 -07:00
Mike Welsh
f5710854b2
avm1: Fix off-by-one bug in Activation::has_local_register
2019-10-15 17:10:34 -07:00
Mike Welsh
e315fcb6b3
swf: Store register count from DefineFunction2
...
Also update avm1::Function to use register_count.
2019-10-15 17:09:14 -07:00
David Wendt
ad17166c63
Store the player version in `Avm1` so that `current_swf_version` doesn't require the context.
2019-10-13 18:55:39 -04:00
David Wendt
7e2cf03789
Implement register underflow behavior.
...
This has the side effect of letting us remove the `Option` on register_count since setting this to `0` is equivalent now. Furthermore, we can skip an allocation if a function requests no registers.
2019-10-13 18:41:07 -04:00
David Wendt
911cf64cb0
Fix clippy lints
2019-10-13 17:58:21 -04:00
David Wendt
e830273fe5
Don't pull multiple borrows on the same `GcCell`
2019-10-13 17:54:09 -04:00
David Wendt
911de06584
Only version MovieClips. Unversioned display objects recursively read their parents' versions, or the default version otherwise.
2019-10-13 17:27:04 -04:00
David Wendt
269775c0e1
Implement the SWF5 version negotiation algorithm.
...
On SWF5, the SWF version of the callee depends on it's this parameter. Calling it as a function rather than a method downgrades the callee. SWF6+ use the callee's inherent SWF version and do not allow changing the SWF version like this.
2019-10-12 10:39:55 -04:00
David Wendt
d543e67528
Inline the first 8 registers with a `SmallVec`.
2019-10-12 10:39:54 -04:00
David Wendt
ff7fe94e90
Add test for `_global`, `_root`, and `_parent` as movie clip properties
2019-10-12 10:39:54 -04:00
David Wendt
b3c955b4d8
Install the remainder of tests that currently pass, but needed to have child clips removed
2019-10-12 10:39:54 -04:00
David Wendt
d909fb01bb
Use player version as a fallback when the current SWF version is requested without a valid stack.
2019-10-12 10:39:53 -04:00
David Wendt
17b1e0429c
Explicitly allow `_global` and `_root` to be overwritten.
2019-10-12 10:39:53 -04:00
David Wendt
4709d2d0b4
Revert "Allow overwriting virtual properties via setting `set` to `None`."
...
This reverts commit 0a8adfca6e5fce8835552c1c7aba063649ba3aeb.
2019-10-12 10:39:53 -04:00
David Wendt
59dc35b8a4
Allow scope chain resolution to retrieve virtual properties
2019-10-12 10:39:53 -04:00
David Wendt
a92190a456
Support pre-resolving `_parent`
2019-10-12 10:39:52 -04:00
David Wendt
0f04d97002
Move `_global` and `_root` to the MovieClip object, and implement `_parent` while we're in here.
2019-10-12 10:39:52 -04:00
David Wendt
d35e36def5
Allow overwriting virtual properties via setting `set` to `None`.
2019-10-12 10:39:52 -04:00
David Wendt
feaa3dd203
Add a version parameter to every DisplayObject impl
2019-10-12 10:39:52 -04:00
David Wendt
8668d47403
Add a player version parameter and expose it to AVM
2019-10-12 10:39:51 -04:00
David Wendt
2f257c83e8
Remove the representation split between functions defined with `DefineFunction` and `DefineFunction2`. Both are now represented with a single struct and enum.
2019-10-12 10:39:51 -04:00
David Wendt
caa36bfecc
Add `closure_scope` and `variable_args` tests.
2019-10-12 10:39:51 -04:00
David Wendt
b4ddd323f2
Use the same methodology to construct new scopes for tellTarget.
2019-10-12 10:39:51 -04:00
David Wendt
1b62ead082
Construct the closure scope chain in one pass, which lets us skip the vec allocation.
2019-10-12 10:39:50 -04:00
Mike Welsh
3b42c70e48
core: Disable LZMA support by default
2019-10-12 00:09:10 -07:00
Mike Welsh
1ab5211bfe
swf: Fix compiling with lzma feature
2019-10-11 23:18:57 -07:00
Mike Welsh
7a5b2607d4
chore: Renormalize line endings in misc files
2019-10-11 16:53:36 -07:00
Mike Welsh
4aec120ffb
core: Add Bitmap display object
...
Converts the Bitmap character to a proper display object. This can
be instantiated directly in a PlaceObject tag in SWFv9 movies,
compared to the previous versions which indirectly references
bitmaps from Shape tags.
2019-10-11 16:33:58 -07:00
Mike Welsh
800147043a
swf: Try to recover from incorrect zlib streams
...
Some SWFs are compressed incorrectly, often with incorrect
compressed/uncompressed lengths, causing the zlib decoders
to vomit if you try to decompress them fully. However, often times
the data still decompresses all the way to the End tag, and we
still want to try to play it even if it's corrupt.
Now these errors only omit a warning, and we'll continue to run
the SWF.
Addresses #86 .
2019-10-10 13:41:43 -07:00
Mike Welsh
40722dcef0
avm1: Merge#81, add property attributes
...
Added object property attributes
2019-10-09 10:24:21 -07:00
Will Brindle
ba939fc00b
chore: add comment explaining the weird NaN situation
2019-10-09 06:17:41 +01:00
Will Brindle
32554e271f
chore: remove trailing whitespace
2019-10-08 21:40:15 +01:00
Will Brindle
f84f807bf1
core: refactor to make use of equality implementation
2019-10-08 21:36:50 +01:00
Will Brindle
70b7b1c807
chore: fix clippy & fmt issues
2019-10-08 21:04:26 +01:00
Will Brindle
6508ec6b6c
core: nan equality
2019-10-08 20:51:21 +01:00
Will Brindle
0814b17fd8
chore: add tests for equality and greaterthan
2019-10-08 20:45:39 +01:00
Will Brindle
e2c7af5cda
core: fix boolean strict comparison
2019-10-08 19:59:32 +01:00
Will Brindle
9cf381b0e0
core: add support for actions GreaterThan, StringGreaterThan and StrictEquals
2019-10-08 19:59:32 +01:00
Nathan Adams
d697d03cf0
Drop the `Attribute::` everywhere
2019-10-08 20:35:23 +02:00
Mike Welsh
fb442688cb
chore: Change edit_text.rs to LF line endings
2019-10-08 11:15:15 -07:00
Nathan Adams
3d09ec81e2
Add Attribute::DontEnum
2019-10-08 16:36:39 +02:00
Nathan Adams
f782aaee18
Add Attribute::ReadOnly
2019-10-08 15:24:57 +02:00
Nathan Adams
f2a4000ee2
Added object property attributes (initially just DontDelete)
2019-10-08 14:30:36 +02:00
Will Brindle
4856efe7d8
chore: add integration tests for typeof
2019-10-08 02:59:26 -07:00
Will Brindle
2e3748438a
core: define globals for NaN, Infinity, -Infinity. Should fix `typeof NaN`
2019-10-08 02:59:26 -07:00
Mike Welsh
3b288272d4
text: Hack to skip HTML in dynamic text fields
2019-10-07 23:23:45 -07:00
Mike Welsh
eded29ce6d
text: Add dummy implementation of device text
...
Embed an SWF version of Noto Sans (core/assets/*) into the player.
The player will load this font and use it to render device text.
This is a quicky implementation to get dynamic device text
rendering.
2019-10-07 23:23:45 -07:00