Commit Graph

3239 Commits

Author SHA1 Message Date
David Wendt 37eb746989 core: Don't warn when associating sounds to AS3 classes 2021-09-03 16:47:02 -06:00
David Wendt 0c591f3370 avm2: Stub implementation of `Sound` and accompanying object type 2021-09-03 16:47:02 -06:00
David Wendt 70556e5830 avm2: Forbid `applytype` opcodes with more than one argument type. 2021-09-02 17:57:58 -06:00
David Wendt e2bf0a9857 avm2: Prohibit naming types with more than one parameter, as they don't exist. 2021-09-02 17:57:58 -06:00
David Wendt 141b992a73 avm2: Storing past the end of a vector only works for the immediate one-off-the-end index 2021-09-02 17:57:58 -06:00
David Wendt 8cd2b4fd5e avm2: Fill vector holes with the default value at creation time instead of storing them. 2021-09-02 17:57:58 -06:00
David Wendt 3b48216762 avm2: Don't store more than one object parameter, because there are no classes with multiple paramters. 2021-09-02 17:57:58 -06:00
David Wendt 5c740ef1e1 chore: Grammar 2021-09-02 17:57:58 -06:00
David Wendt d1b9df61f3 avm2: Move `Vector`'s properties to the AS3 namespace and add prototype properties in the public one 2021-09-02 17:57:58 -06:00
David Wendt cc15809f49 avm2: Add the ability to have a separate class initializer for each specialization of `Vector` 2021-09-02 17:57:58 -06:00
David Wendt e087a27e56 avm2: `Vector.sort` actually *does* calculate an indexed sort array, but then discards it.
Normally we could skip sorting, but values in the vector may have side effects when coerced. So we need to make sure coercions run, at least.
2021-09-02 17:57:58 -06:00
David Wendt 280fbbde45 avm2: Pick nits in `Vector`'s `instance_init` 2021-09-02 17:57:58 -06:00
David Wendt 2095c1831a avm2: Replace some if expressions with easier-to-read equivalents 2021-09-02 17:57:58 -06:00
David Wendt 464605d015 avm2: Pre-allocate all the things 2021-09-02 17:57:58 -06:00
David Wendt bf4492c454 avm2: Add the legacy Vector types that old movies can use.
This one was rather tough to test, as I actually can't generate ABCs in Animate CC that reference these classes. I instead had to modify a compiled SWF to open the package-internal namespace that these pre-specialized classes exist in.
2021-09-02 17:57:58 -06:00
David Wendt dcf6d87363 avm2: Accept `null` as a valid type in `applytype`.
In AVM2, the `*` (any) type is represented as `null`.

This requires also changing the parameters on classes and objects to be nullable, too.

We do *not* represent `null` as a particular value on the underyling vector storage object, however. We instead change it to `Object`, as that's the root of all other types.

This may require revision if non-`Object`-extending types appear in the future.
2021-09-02 17:57:58 -06:00
David Wendt ee30f21e8e avm2: Remove unnecessary `mut` 2021-09-02 17:57:58 -06:00
David Wendt aaddcc598f avm2: Impl `Vector.toLocaleString` and test `toString` 2021-09-02 17:57:58 -06:00
David Wendt d1e49db3cc avm2: Stub `Number.toLocaleString`
This exists but is undocumented, and I accidentally wrote a Vector test that needs it.
2021-09-02 17:57:58 -06:00
David Wendt dbc6f38c34 avm2: Impl `Vector.splice` 2021-09-02 17:57:58 -06:00
David Wendt 81d0775776 avm2: Impl `Vector.sort` 2021-09-02 17:57:58 -06:00
David Wendt 9fcd846a4d avm2: Fix ineffective Vector typechecks 2021-09-02 17:57:58 -06:00
David Wendt 44a9f13047 avm2: Impl `Vector.slice` 2021-09-02 17:57:58 -06:00
David Wendt 077fd87842 avm2: Impl `Vector.reverse` 2021-09-02 17:57:58 -06:00
David Wendt aa2d729a44 avm2: Impl `Vector.removeAt` 2021-09-02 17:57:58 -06:00
David Wendt a053015558 avm2: Impl `Vector.insertAt` 2021-09-02 17:57:58 -06:00
David Wendt 6b78e86ddc avm2: Impl `Vector.shift` and `Vector.unshift` 2021-09-02 17:57:58 -06:00
David Wendt 1cfa9e0b28 avm2: Impl `Vector.push` and `.pop` 2021-09-02 17:57:58 -06:00
David Wendt 6350ce2dde avm2: Impl `Vector.map` 2021-09-02 17:57:58 -06:00
David Wendt 7628b2b49a avm2: Impl `Vector.lastIndexOf` (and the weird backward-index behavior of `indexOf`) 2021-09-02 17:57:58 -06:00
David Wendt 4624157ae0 avm2: Impl `Vector.indexOf` 2021-09-02 17:57:58 -06:00
David Wendt 622be142c3 avm2: Specialize generic classes when resolving types whose names have parameter names also in them.
Any is, as usual, special-cased. In this case, we treat it as specializing to `Object`, since all vectors should be coercible to `Object`.
2021-09-02 17:57:58 -06:00
David Wendt c06a3c10d8 avm2: Impl `Vector.filter` 2021-09-02 17:57:58 -06:00
David Wendt d079c647fa avm2: Parameter types can be `*`. 2021-09-02 17:57:58 -06:00
David Wendt f00234ce26 avm2: Consider specializations of generic classes to be of the same type as other specializations of the same class when their parameters are also of the same type.
For example, instances of `Vector.<Class>` are considered to be of type `Vector.<Interface>` in the same way that instances of `Class` are considered to be of type `Interface`. This assumes `Class` implements `Interface`.

This does *not* apply to the builtin coercions for numeric and string types, which do not extend to generic parameters. For example, `Vector.<uint>` is *not* coercible to `Vector.<int>`, even though it's contents *are*.
2021-09-02 17:57:58 -06:00
David Wendt 4d962f154e avm2: Don't run initializers on vectors as they overwrite the existing vector storage. 2021-09-02 17:57:58 -06:00
David Wendt fcc7c9e7ee avm2: Propagate the specialized class parameter into the vector storage so that coercions happen correctly. 2021-09-02 17:57:58 -06:00
Adrian Wielgosik 2560bdc804 chore: Drop unnecessary mut 2021-09-02 17:57:58 -06:00
Adrian Wielgosik 846b53dc1b avm2: Impl `Vector.forEach` 2021-09-02 17:57:58 -06:00
Adrian Wielgosik 8a77494b2f avm2: Impl `Vector.some` 2021-09-02 17:57:58 -06:00
Adrian Wielgosik 519feb9af7 avm2: `Array.every/some` should early return 2021-09-02 17:57:58 -06:00
Adrian Wielgosik 07f979b582 avm2: `Vector.every` should early return 2021-09-02 17:57:58 -06:00
David Wendt 97e6f55110 avm2: Impl `Vector.every` 2021-09-02 17:57:58 -06:00
David Wendt aa0946c64c avm2: Impl `Vector.fixed` 2021-09-02 17:57:58 -06:00
David Wendt 841ed4b5e4 avm2: Setting to an out-of-bounds index on a growable `Vector` should grow it 2021-09-02 17:57:58 -06:00
David Wendt 238959d7f8 avm2: Impl `Vector.join` and `toString` 2021-09-02 17:57:58 -06:00
David Wendt 1ce7e4e642 avm2: `Vector` is a final class (no matter what the docs say) 2021-09-02 17:57:58 -06:00
David Wendt dba9b18540 avm2: Impl `Vector.concat` 2021-09-02 17:57:58 -06:00
David Wendt 96afc5a6c2 avm2: Cache all `Vector` applications on the `Vector` class object.
This matches Flash Player behavior: notably, multiple applications of the same types see the same class and prototype, but different applications actually create new objects that don't share properties.
2021-09-02 17:57:58 -06:00
David Wendt 888fcc85ca avm2: Impl `Vector.length` 2021-09-02 17:57:58 -06:00
David Wendt 9d08a7c299 avm2: Impl `Vector`'s instance initializer 2021-09-02 17:57:58 -06:00
David Wendt 49d79b8e73 avm2: Vector indices are stored in a package namespace 2021-09-02 17:57:58 -06:00
David Wendt 3d3b80f8af avm2: ES3 class instances should be treated as instances of the ES4 class `Object`. 2021-09-02 17:57:58 -06:00
David Wendt 6b377bed64 avm2: Impl `apply` for ES4 classes to allow type parameterization 2021-09-02 17:57:58 -06:00
David Wendt 65a23d5833 avm2: Move applytype next to other operations that create classes 2021-09-02 17:57:58 -06:00
David Wendt 074c093504 avm2: Implement op `ApplyType` 2021-09-02 17:57:58 -06:00
David Wendt 4b021fe92c avm2: `Vector` lives in a separate package from other globals 2021-09-02 17:57:58 -06:00
David Wendt 74cb32dd46 avm2: Allow constructing static `TypeName`s (for naming `Vector` classes) 2021-09-02 17:57:58 -06:00
David Wendt 7e71ecac16 avm2: Add stub impl of `Vector` 2021-09-02 17:57:58 -06:00
David Wendt 6f49e62b96 avm2: First pass on implementing vector storage 2021-09-02 17:57:58 -06:00
David Wendt f4dfc4d778 avm2: First pass at type-aware vector storage 2021-09-02 17:57:58 -06:00
David Wendt 686872812d avm2: Add a `TObject` method for applying arguments to a generic type. 2021-09-02 17:57:58 -06:00
David Wendt fe8373739d avm2: Add the ability to fork a `Class` to one that holds it's type arguments. 2021-09-02 17:57:58 -06:00
David Wendt 86616b748f avm2: Allow parsing generic typenames into a multiname 2021-09-02 17:57:58 -06:00
David Wendt 47e3b2229a swf: Add support for the `TypeName` multiname type. 2021-09-02 17:57:58 -06:00
David Wendt 7277f14198 core: Delay execution of AVM2 constructors on buttons by one frame. 2021-08-31 21:21:54 -06:00
David Wendt 472ba6db1f core: AVM2 buttons only emit frame construction events and frame scripts if they were timeline-constructed. 2021-08-31 21:21:54 -06:00
David Wendt b1ba591bb9 core: Support constructing symbolclassed buttons from AVM2 2021-08-31 21:21:54 -06:00
David Wendt 7c970e144f core: `Avm2Button` should always call it's native initializer 2021-08-31 21:21:54 -06:00
Chris Midgley bc4422f4fe chore: fix docstring 2021-08-31 22:47:13 +03:00
dependabot[bot] 5af5fb579e chore: Bump flate2 from 1.0.20 to 1.0.21
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.20 to 1.0.21.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.20...1.0.21)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 09:04:44 +03:00
David Wendt 80c5bbcd83 avm2: Stub `Font.enumerateFonts` and `Font.registerFont` 2021-08-30 17:53:39 -06:00
David Wendt 2d57bed82e avm2: Impl `Font.hasGlyphs` 2021-08-30 17:53:39 -06:00
David Wendt 37af9be533 avm2: Implement `Font` for embedded fonts. 2021-08-30 17:53:39 -06:00
dependabot[bot] 7f2f8a492e chore: Bump png from 0.17.0 to 0.17.1
Bumps [png](https://github.com/image-rs/image-png) from 0.17.0 to 0.17.1.
- [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)

---
updated-dependencies:
- dependency-name: png
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-30 23:27:18 +02:00
dependabot[bot] 3136331e85 chore: Bump serde from 1.0.128 to 1.0.130
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.128 to 1.0.130.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.128...v1.0.130)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-30 22:31:27 +02:00
Adrian Wielgosik 945bce4a85 xml: Use forked quick-xml to support loose entity parsing 2021-08-30 19:08:22 +02:00
EmperorBale 358e0641eb avm2: Use rsplit_once instead of split_once 2021-08-29 20:41:20 -06:00
EmperorBale 05b4ee6b61 avm2: Dont panic if as_class returns None 2021-08-29 20:41:20 -06:00
EmperorBale 547aac0e85 chore: Cleanup QName::to_qualified_name 2021-08-29 20:41:20 -06:00
EmperorBale 5dd21cdf8e avm2: Add QName::from_qualified_name and QName::to_qualified_name 2021-08-29 20:41:20 -06:00
EmperorBale 2b748a4870 avm2: Implement getQualifiedClassName, getQualifiedSuperclassName, and getDefinitionByName 2021-08-29 20:41:20 -06:00
Daniel Jacobs 3982f3af98 web: Support menu embed/object attribute (part of #4258) 2021-08-28 14:56:35 +02:00
Adrian Wielgosik b5ee94aff1 avm2: Stub flash.system.Security. 2021-08-26 23:50:42 +02:00
relrelb 0aed180da8 avm1: Rename `SuperObject::child` to `this` 2021-08-26 01:07:37 +03:00
relrelb ec5a9f8ac8 avm1: Avoid `impl Into<Value<'gc>>` parameters
This might create templatized functions leading to unnecessary code bloat.

So instead use just `Value<'gc>` parameters and add `.into()` in callers
where needed.
2021-08-26 01:07:37 +03:00
relrelb 364f93fd92 avm1: Remove `SuperObject::as_executable`
It was identical to the default implementation of `TObject`, and
thus unnecessary.
2021-08-26 01:07:37 +03:00
relrelb 90a544a34a avm1: Inline `SuperObject::super_constr` 2021-08-26 01:07:37 +03:00
relrelb dff74dcb92 avm1: Simplify `SuperObject::from_this_and_base_proto` 2021-08-26 01:07:37 +03:00
relrelb 1bd46c6d59 avm1: Rename `ScriptObject::values` to `properties`
To better reflect their meaning.
2021-08-26 01:07:37 +03:00
relrelb fd7d32bc14 avm1: `DisplayGetter` cannot fail
So instead of always returning `Ok` from all getters, simply return a
`Value`.
2021-08-24 02:15:43 +03:00
lukaszN 8e596c2a35 avm2: Rectangle fix clippy 2021-08-23 15:44:14 -06:00
lukaszN b7b66ab9b8 avm2: impl Rectangle isEmpty, offset, offsetPoint, setEmpty, union 2021-08-23 15:44:14 -06:00
lukaszN f5c491a14f avm2: impl Rectangle intersection, intersects 2021-08-23 15:44:14 -06:00
lukaszN e22cd6bdbd avm2: impl Rectangle inflate, inflatePoint 2021-08-23 15:44:14 -06:00
lukaszN 129cd1af58 avm2: impl Rectangle contains, containsPoint, containsRect, copyFrom 2021-08-23 15:44:14 -06:00
lukaszN 3670676e2d avm2: Impl Rectangle topLeft, size, clone, equals 2021-08-23 15:44:14 -06:00
lukaszN 85afeb1de7 avm2: Impl Rectangle setters and getters 2021-08-23 15:44:14 -06:00
lukaszN ee9e70b71f avm2: Initial rectangle impl 2021-08-23 15:44:14 -06:00
dependabot[bot] d8457d175b chore: Bump serde from 1.0.127 to 1.0.128
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.127 to 1.0.128.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.127...v1.0.128)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 23:46:47 +03:00
dependabot[bot] f8c069442f chore: Bump syn from 1.0.74 to 1.0.75
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.74 to 1.0.75.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.74...1.0.75)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-23 23:45:53 +03:00
TÖRÖK Attila 1674c95487 Fix a typo in a comment introduced in #5021 2021-08-22 11:45:33 +03:00
relrelb 1e7bdaa226 chore: Minor improvement 2021-08-22 01:03:10 +03:00
Tomasz Konojacki a3747ade5e core: fix integer overflow in ADPCM decoder
The maximum possible value of delta is 63483, so it needs to be
declared as u16.

Fixes #5030
2021-08-22 01:03:10 +03:00
David Wendt 57fffbe699 video: Use the new `H263State.parse_picture` convenience method 2021-08-21 14:13:55 -06:00
Mike Welsh 1f951b6b9f core: Add h263 feature 2021-08-21 14:13:55 -06:00
Mike Welsh a05f81b393 video: Add VideoDecoder trait
Change VideoStream to use a VideoDecoder trait instead of an enum.
This will make it a little easier as more codecs are added, and
allow us to easily enable/disable codecs behind features.
2021-08-21 14:13:55 -06:00
David Wendt 48fa03b87d video: Reuse the same bitmap whenever possible 2021-08-21 14:13:55 -06:00
David Wendt 05692cee67 video: Allow pictures with half-pixels in chroma by widening the chroma buffers to the next pixel in that direction. 2021-08-21 14:13:55 -06:00
David Wendt 43f76de602 video: Move software decoding into core now that we don't need to specialize per-renderer 2021-08-21 14:13:55 -06:00
David Wendt 885805f887 core: Half-implement an H.263 decoder 2021-08-21 14:13:55 -06:00
Tal Hayon 7b9049cedf core: Add DefineBinaryData and SymbolClass connection (Part of #1368) 2021-08-21 12:24:46 -06:00
relrelb 41142d940c avm1: Turn `TObject::call_setter` to `TObject::setter`
Remove the unused `value` parameter and rename the function to clarify
its meaning.
2021-08-21 17:23:15 +03:00
relrelb fd0e76020f avm1: Allow stored and virtual properties to co-exist
Currently properties added using `addProperty` overwrite existing
stored properties. However, there are some cases where the original
stored value can still be retrieved, which indicates that Flash
Player doesn't overwrite these properties internally.

As a solution, unify `Property::Stored` and `Property::Virtual` to
a single struct. This allows to simultaneously store regular data
and getter/setter on the same property. It also simplifies some
logic in `ScriptObject`.
2021-08-21 17:23:15 +03:00
TÖRÖK Attila a1311443a6 avm1/bitmap: Replace BitmapData.color_transform() argument with AVM-agnostic ColorTransformParams 2021-08-20 21:29:54 -06:00
TÖRÖK Attila b31ad28960 avm1: Make add_field_accessors! accept nested field names 2021-08-20 21:29:54 -06:00
TÖRÖK Attila 57ccb714c6 core,avm1: Extract ColorTransformParams from ColorTransformData 2021-08-20 21:29:54 -06:00
TÖRÖK Attila 2048bb9887 core,avm1: Move BitmapData implementation into core::bitmap from core::avm1::object
This enables exposing it to AVM2 as well in the future.
2021-08-20 21:29:54 -06:00
Ray Redondo 27e06af003
avm2: Initial MouseEvent stubs (#5065)
* avm2: Start MouseEvent stubs

* avm2: More MouseEvent work

* chore: clippy

* chore: fmt

Co-authored-by: Adrian Wielgosik <adrian.wielgosik@gmail.com>
2021-08-21 01:26:34 +02:00
Chris Midgley 58c907e985
avm2: implement string.split for undefined (#5064)
* avm2: implement string.split for undefined

* chore: cargo fmt

* dev: avoid explicit ArrayStorage
2021-08-18 18:02:41 +02:00
relrelb da7cd453cf chore: Fix png update 2021-08-18 09:01:21 +03:00
dependabot[bot] 0e408052b1 chore: Bump png from 0.16.8 to 0.17.0
Bumps [png](https://github.com/image-rs/image-png) from 0.16.8 to 0.17.0.
- [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)

---
updated-dependencies:
- dependency-name: png
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-18 09:01:21 +03:00
relrelb ac3c198bda chore: Appease clippy 2021-08-18 08:01:57 +03:00
dependabot[bot] b8a9e28acb chore: Bump bitstream-io from 1.1.0 to 1.2.0
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases)
- [Commits](https://github.com/tuffy/bitstream-io/compare/v1.1.0...v1.2.0)

---
updated-dependencies:
- dependency-name: bitstream-io
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-17 08:24:29 +03:00
dependabot[bot] a317a09d17 chore: Bump bitflags from 1.2.1 to 1.3.2
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.2.1 to 1.3.2.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/1.2.1...1.3.2)

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-16 23:41:06 +03:00
Adrian Wielgosik f4da77c400 Use a more idiomatic pattern for unwrap-or-default 2021-08-15 21:55:49 +02:00
David Wendt f37a06241a chore: Clippy compliance with latest nightly compiler 2021-08-14 19:51:24 -06:00
Ray Redondo cfb2bb99d6 chore: appease clippy 2021-08-14 00:52:38 +02:00
Ray Redondo 638eaf4a55 avm2: Rename function, add runtime warnings 2021-08-14 00:52:38 +02:00
Ray Redondo 171a41b908 avm2: Add define_public_builtin_class_traits and repair Capabilities to use it 2021-08-14 00:52:38 +02:00
Ray Redondo c43f57e5f5 avm2: Implement `String.split` 2021-08-14 00:52:38 +02:00
Ray Redondo 22c6f7321e avm2: start flash.system.Capabilities stubs 2021-08-14 00:52:38 +02:00
Tal Hayon 332f1d47bb core: Reset mouse visible when loading movie to root (Fixes #4358) 2021-08-11 23:18:57 +02:00
David Wendt 84f17d1222 chore: Update `flash-lso`'s dependent commit ID 2021-08-09 18:47:03 -06:00
relrelb d40cf5aee4 avm1: Log internal error on `InvalidSwf`
This gives more percise error logs that ease finding their root
cause. Also remove `is_halting` and express it inline instead.
2021-08-03 14:40:59 -07:00
Tal Hayon 6762675bb5 core: Fixes several text edit font and bullet issues (parts of #1167) 2021-08-03 13:08:06 -07:00
dependabot[bot] 36e96b7272 chore: Bump serde from 1.0.126 to 1.0.127
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.126 to 1.0.127.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.126...v1.0.127)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-03 10:18:58 +03:00
Adrian Wielgosik b940e7f00f Extension: Sidestep CORS issues by offering to load the SWF in a tab 2021-08-02 21:28:16 +02:00
relrelb 141f886cdd avm1: Remove `TObject::set_proto`
The last usage of it was in `Player`, which anyway should operate
only on newly created objects that don't have any virtual properties
nor watchers. So it is safe to replace with `define_value`, that
also cannot fail.
2021-07-30 17:42:42 -07:00
relrelb fd3f9f34de avm1: Store `__proto__` as a regular property
`__proto__` seems to behave much like a regular data property. So
simply remove the `prototype` field of `ScriptObject` in favor of
storing the prototype in the general properties hash map.
2021-07-30 17:42:42 -07:00
relrelb 6b91239e28 avm1: Don't rely on prototypes during serialization
Instead, rely on the `TObject::as_*` methods to tell what kind the
serialized object is.
2021-07-24 04:12:34 -07:00
relrelb 06fce44665 avm1: Fix performance regression in `BitmapData::pixels_rgba`
It was regressed in #4822 when changed to use `flat_map`. But
currently Rust emits suboptimal code for such case. For now use
`Vec::with_capacity` manually to avoid unnecessary re-allocations.
2021-07-24 03:28:35 -07:00
EmperorBale 1dee1e4166 avm2: Implement flash.crypto.generateRandomBytes 2021-07-21 18:09:21 +02:00
David Wendt db86ca84b9 avm2: `get_property` does not mutate the underlying object (anymore) so it should not be flagged as mutably borrowing it. 2021-07-20 22:14:05 -04:00
David Wendt c30014baed avm2: Remove `ScriptObjectClass` and replace with separately implemented methods on `ClassObject` 2021-07-20 22:12:33 -04:00
David Wendt 4d89341e19 avm2: Cache the instance allocator on class objects 2021-07-20 22:12:33 -04:00
David Wendt 2c927f2b6b avm2: Make `coerce_to_type` take a class object instead of a multiname. 2021-07-20 22:12:33 -04:00
David Wendt bd2f758976 avm2: Don't call native initializers when coercing primitives into objects.
The former native initializer call was incorrect and would cause spurious coercion failures. Since existing code assumes the error fork of `coerce_to_object` means undefined or null, this was causing coercions and parameter typechecks against primitives to fail in the most general case.

Attempting to fix this by providing the primitive value as native initializer argument instead causes a stack overflow. This is because native initializer arguments still have to be typechecked, and in the most general case this means... coercing the primitive value we're already coercing into an object... into another object. This won't work.

Since primitive initializers aren't going to do anything that native coercions need to care about, I'm just removing the initializer call.
2021-07-20 22:12:32 -04:00
David Wendt 30b4c4386b avm2: Replace the `call_strict` mechanism with checking to see if free functions are unchecked. 2021-07-20 22:12:32 -04:00
David Wendt ddd73b3cd6 avm2: Supercalls should fall back to normal receiver access if there is no matching supertrait to use. 2021-07-20 22:12:31 -04:00