Commit Graph

4050 Commits

Author SHA1 Message Date
dependabot[bot] 86e3f6c82a build(deps): bump serde from 1.0.136 to 1.0.137
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.136 to 1.0.137.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.136...v1.0.137)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 13:41:28 -07:00
Adrian Wielgosik b2f309fc35 avm1: Implement LocalConnection.domain() 2022-04-30 16:14:16 -07:00
relrelb babf49aaf9 chore: `.filter_map(..).next()` -> `.find_map(..)`
Per the rust-analyzer diagnostic: https://rust-analyzer.github.io/manual.html#replace-filter-map-next-with-find-map
2022-04-30 10:41:46 -07:00
Mike Welsh 1eb06908c8 core: Make PlayerBuilder::build infallible 2022-04-29 09:14:32 -07:00
Mike Welsh 3e15ca4cad core: Use `Arc::new_cyclic` in player initialization
Co-authored-by: relrelb <relrelbachar@gmail.com>

Change `UpdateContext::player` to not be an `Option`
2022-04-29 09:14:32 -07:00
Mike Welsh ddc28310f8 core: Clean up test_utils 2022-04-29 09:14:32 -07:00
Mike Welsh f48182ef3d core: Add various settings to PlayerBuilder 2022-04-29 09:14:32 -07:00
Mike Welsh 895508a0fb core: Remove Player::new
PlayerBuilder is effectively the Player constructor.
2022-04-29 09:14:32 -07:00
Mike Welsh e1e2b1008a core: Add PlayerBuilder 2022-04-29 09:14:32 -07:00
Mike Welsh 2453626dec core: Add MemoryStorageBackend::new 2022-04-29 09:14:32 -07:00
David Wendt 155672d482 core: Remove AS3-related `coerce_to_object` calls in `MovieClip` 2022-04-24 16:54:19 -07:00
David Wendt fe50e98f87 avm2: Remove `coerce_to_object` calls in `flash.text.TextField` 2022-04-24 16:54:19 -07:00
David Wendt afdae1f6c6 avm2: Remove `coerce_to_object` calls in `flash.media.Sound` 2022-04-24 16:54:19 -07:00
David Wendt 818526069e avm2: Remove `coerce_to_object` calls in `flash.events.MouseEvent` 2022-04-24 16:54:19 -07:00
David Wendt 5dc5ca06e3 avm2: Remove `coerce_to_object` calls in `flash.events.EventDispatcher` 2022-04-24 16:54:19 -07:00
David Wendt 4c736094c1 avm2: Remove `coerce_to_object` calls in `flash.display.Stage` 2022-04-24 16:54:19 -07:00
David Wendt cbc9937fcf avm2: Remove `coerce_to_object` calls in `flash.display.SimpleButton` 2022-04-24 16:54:19 -07:00
David Wendt 40ecae28d0 avm2: Remove `coerce_to_object` in `flash.display.MovieClip` 2022-04-24 16:54:19 -07:00
David Wendt 85b598a8da avm2: Remove `coerce_to_object` calls in `flash.display.DisplayObjectContainer` 2022-04-24 16:54:19 -07:00
David Wendt 7e7ee14d3b avm2: Remove `coerce_to_object` calls in `flash.display.DisplayObject`. 2022-04-24 16:54:19 -07:00
David Wendt 5f5f98ecdc avm2: Remove `coerce_to_object` calls in `flash.display.Bitmap` 2022-04-24 16:54:19 -07:00
David Wendt 5b5313bf95 avm2: Remove `coerce_to_object` calls in `String` impls 2022-04-24 16:54:19 -07:00
David Wendt e851b73570 avm2: Remove calls to `coerce_to_object` in `JSON` impls 2022-04-24 16:54:19 -07:00
David Wendt 88f4ebc2a3 avm2: Remove calls to `coerce_to_object` in `Function` impls 2022-04-24 16:54:19 -07:00
David Wendt 26e65368df avm2: Remove `coerce_to_object` calls in `Array` where possible, and replace with more descriptive error messages otherwise 2022-04-24 16:54:19 -07:00
David Wendt 1383901a94 avm2: Remove unnecessary usage of `coerce_to_object` in `avm2::globals`. 2022-04-24 16:54:19 -07:00
David Wendt 90b239f30d avm2: Add descriptive error messages for when `Vector` methods encounter `null`/`undefined`. 2022-04-24 16:54:19 -07:00
David Wendt e486efb4c6 avm2: Remove unnecessary usage of `coerce_to_object` in `ClassObject`. 2022-04-24 16:54:19 -07:00
David Wendt 0f2b77c138 avm2: Alter basic object operations to use more descriptive error messages. 2022-04-24 16:54:19 -07:00
David Wendt 4185acc5a8 avm2: Remove unnecessary usage of `coerce_to_object` in `avm2::events`. 2022-04-24 16:54:19 -07:00
David Wendt bb70086238 avm2: Replace a number of `coerce_to_object` calls with the previous commits' new messages as appropriate 2022-04-24 16:54:19 -07:00
David Wendt bea6744682 avm2: Add methods to `Value` and `Activation` for performing common coercions and returning a relevant error if they fail.
Those methods are:

 * `Value.coerce_to_receiver`: coerce to object for receivers
 * `Value.as_callable`: as_object for callables
 * `Activation.superclass_object`: get superclass of currently-called object
 * `Activation.resolve_class`: resolve scope value, unwrap `ClassObject`, and error out if either step fails

This accounts for ~80% of coercion-related errors in `Activation`.
2022-04-24 16:54:19 -07:00
David Wendt 2ec606c5cb avm2: Add utilities for formatting `Multiname`s and class instances' names. 2022-04-24 16:54:19 -07:00
relrelb 3dbde841df avm1: Remove `TObject::type_of`
It can be simply determined in `Value::type_of`.
2022-04-23 17:55:48 -07:00
Daniel Jacobs aa92c3c1bc core: scale_mode -> window_mode for set_window_mode 2022-04-22 19:31:23 +03:00
Mike Welsh e2e7ad0df2 avm2: Implement `flash.ui.Keyboard`
Add `Keyboard` key code constants and stub out other properties.
2022-04-21 21:40:04 -07:00
Mike Welsh 1cb3d389e8 core: Add some KeyCode variants 2022-04-21 21:40:04 -07:00
TÖRÖK Attila 7cbba5bc8f avm2: Stub flash.accessibility.AccessibilityProperties 2022-04-19 09:55:09 -07:00
relrelb 25d47da528 render: Improve CMYK to RGB conversion
Use integer arithmetic, which is more accurate and efficient.
2022-04-18 22:00:48 -07:00
Mike Welsh cdccc2a2db avm1: Array.sortOn does not inspect proto or virtual properties
`Array.sortOn` only looks at raw properties and does not inspect
the prototype chain or call virtual properties.
2022-04-18 08:34:04 -07:00
Mike Welsh 3305ac69c4 web: Support wmode parameter 2022-04-17 08:33:51 -07:00
relrelb 87e85e16da render: Make `rgb5_component` a lambda
This way the `compressed` parameter becomes implicit.
2022-04-16 13:52:59 -07:00
relrelb 8feeadf578 render: Use `std::borrow::Cow`
Also apply some nearby refactors.
2022-04-16 13:52:59 -07:00
relrelb eeaec947b3 render: Remove unneeded `pub`s
And remove the dead `glue_swf_jpeg_to_tables` function.
2022-04-16 13:52:59 -07:00
relrelb 9b4108444f render: Strip 16-bit PNG samples to 8-bit
PNGs with 16-bit samples were not being normalized to 8-bit, screwing up their
appearance.

Add the `STRIP_16` transformation using `Transformations::normalize_to_color8()`,
which is equivalent to `Transformations::EXPAND | Transformations::STRIP_16`.
Also warn in case `png` outputs a color type other than `Rgb` and `Rgba`.
Due to the `EXPAND` transformation, this may be only `Grayscale` or
`GrayscaleAlpha`. `Indexed` is converted to either `Rgb` or `Rgba`.

Fixes #6662.
2022-04-16 12:45:55 -07:00
Mike Welsh bce9398c0d avm1: Add Accessibility stub 2022-04-16 09:05:16 -07:00
Toad06 b2b1b5fa25 avm1: Correct `Add`, `Equals`, `Less` and `GetProperty` actions 2022-04-13 22:00:25 -07:00
Mike Welsh 146b8adc68 swf: Clean up LineStyle
* Remove LineStyle::color, instead using fill_style with
   FillStyle::Color to indicate solid color.
 * Store `flags` in the struct instead of separate bools/values.
 * Add getters/setters for ease of use.
 * Add builder-style methods for setting LineStyle properties.
 * Fix misnamed ALLOW_CLOSE flag to NO_CLOSE.
2022-04-11 22:50:40 -07:00
Mike Welsh c0dff98d84 chore: Fix len_zero warning in symphonia Mp3Decoder 2022-04-11 20:15:13 -07:00
Mike Welsh 24f00238a7 audio: Fix symphonia feature
This feature stopped building with the bump to symphonia 0.5, which
added a `Sync` bound to its traits.

 * Add `Sync` bounds to our own internal audio traits to match.
 * nellymoser::Decoder was also tweaked to add a Sync bound.
 * Lock the nellymoser dependency to a specific git commit.
2022-04-11 15:25:15 -07:00
dependabot[bot] a5f7fccca2 build(deps): bump quote from 1.0.17 to 1.0.18
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.17 to 1.0.18.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.17...1.0.18)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 13:51:20 -07:00
dependabot[bot] 5973ecc7d9 build(deps): bump flate2 from 1.0.22 to 1.0.23
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.22 to 1.0.23.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.22...1.0.23)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-11 13:51:09 -07:00
Toad06 c6c1f553d5 avm1: Correct `Action::RandomNumber` 2022-04-11 11:02:08 -07:00
Toad06 e2528b04a7 avm1: Coerce booleans to `"1"` or `"0"` in SWFv4 2022-04-10 20:03:39 -07:00
Toad06 b221485288 avm1: Fix `Action::Divide` in SWFv4 2022-04-09 23:17:39 -07:00
Mike Welsh 91346f5fad avm1: Format floating-point numbers
Co-authored-by: Toad06 <gd.productions@laposte.net>
2022-04-09 22:40:59 -07:00
Mike Welsh 478f970fc8 chore: Appease clippy 2022-04-09 18:23:51 -07:00
Aaron Hill d7532ae654 avm2: Add stubs for `BitmapFilter`, `GlowFilter`, and `DisplayObject.filters`
This gets 'Rolling Hero' further in the startup process,
since it just tries to set a filter on an object.
2022-04-08 16:53:16 -07:00
relrelb ad42b9908f xml: Refactor `XmlNode` creation methods
Unify the previous 3 creation methods to a single `XmlNode::new`.
This allows supporting arbitrary `nodeType` values passed to the
`XMLNode` constructor.
2022-04-08 16:34:57 -07:00
relrelb 7497fb7008 core: Change `Player::set_root_movie` to accept a `SwfMovie`
Move the `Arc::new` to within the function.
2022-04-08 15:16:25 -07:00
Toad06 12737b8431 avm1: Fix `Number(String | Object)` in SWFv4 2022-04-08 10:41:21 -07:00
dependabot[bot] 1339d8b93a build(deps): bump syn from 1.0.90 to 1.0.91
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.90 to 1.0.91.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.90...1.0.91)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:40:43 -07:00
dependabot[bot] 860c2e313f build(deps): bump encoding_rs from 0.8.30 to 0.8.31
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs) from 0.8.30 to 0.8.31.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases)
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.30...v0.8.31)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-08 10:40:26 -07:00
relrelb eeb5eb18f6 web: Bump wasm-bindgen to 0.2.80
As usual, also bump its helper crates (`js-sys`, `web-sys` and
`wasm-bindgen-futures`) to the latest versions.
2022-04-08 09:56:23 -07:00
dependabot[bot] e456fb3ed6 build(deps): bump jpeg-decoder from 0.2.3 to 0.2.4
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.2.3 to 0.2.4.
- [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/compare/v0.2.3...v0.2.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-04 14:42:32 -07:00
Mike Welsh 6ec3049e02 desktop: Use floats for audio start/endpoints calculation (fix #6569)
Integer math was used when calculating a sound's start/endpoints,
because it was assumed that the sound sample rate was always an
even divisor of 44100Hz. However, some third party tools can embed
MP3s with other samples rates, such as #6569 which has a 16000Hz
MP3. This could also occur for dynamically loaded MP3s. This
results in the sound starting at an incorrect position.

Use floating point math to ensure the correct position is
caluclated.

Fixes #6569.
2022-04-03 15:50:43 -07:00
Mike Welsh 9687365885 core: Remove morph shape preloading
Remove the preload step that would pre-create the shapes for each
morph shape ratio on SWF load. Instead, lazily crate the shapes
when they are needed.
2022-04-03 13:50:09 -07:00
Mike Welsh b1879f4b99 core: Fix divide-by-zero in Video::seek (fix #6605) 2022-04-03 11:33:52 -07:00
Toad06 055e1d4dc1 avm1: Fix `loadVariablesNum` / `Action::GetUrl2` 2022-04-03 10:32:31 -07:00
Toad06 e93d39fdfe avm1: `DefineLocal` also accepts dot and slash paths 2022-04-02 14:30:56 -07:00
relrelb c8e7bdbce2 core: Fix loading of unknown data
Loading unknown data is not considered an error on Flash; Both
`onLoadProgress` and `onLoadComplete` events are dispatched. But,
`onLoadProgress` reports 0 bytes loaded.
2022-04-02 12:50:43 -07:00
relrelb e06506c2b9 render: Implement `CMYK32` jpeg pixel format 2022-04-02 01:17:38 +03:00
Aaron Hill 4f23500779 avm2: Implement most of `flash.external.ExternalInterface`
This re-uses the logic we have for handling AVM1's `ExternalInterface`.
For now, serialization/deserialization of non-array objects is
left unimplemented.
2022-03-31 22:40:09 -07:00
Mike Welsh 659db7facc avm1: Add2 calls valueOf for objects 2022-03-31 16:57:07 -07:00
Adrian Wielgosik a929a4becd avm2: Do not borrow Object's lock just to get the bound method 2022-03-31 16:56:55 -07:00
Adrian Wielgosik 7e8738d82e avm2: Add ContextMenuEvent stub 2022-03-30 21:42:48 +02:00
Adrian Wielgosik ef64413b8c avm2: Support ContextMenuItem fields 2022-03-30 21:42:48 +02:00
Adrian Wielgosik ea56902d80 chore: cargo fmt 2022-03-30 21:42:48 +02:00
Adrian Wielgosik 90b1d4722c avm2: Add ContextMenuItem stub 2022-03-30 21:42:48 +02:00
Adrian Wielgosik 2389422c99 avm2: Add ioErrorEvent stub 2022-03-30 21:42:48 +02:00
Adrian Wielgosik 388dc6fe31 avm2: Add customItems to ContextMenu stub 2022-03-30 21:42:48 +02:00
Mike Welsh d920dfa9b0 core: Add padding on autosized TextFields 2022-03-29 22:22:32 -07:00
Mike Welsh a671d2977b core: Pre-multiply alpha when loading PNG/GIF data (fix #6559)
When decoding PNG/GIF data, convert the image to premultiplied
alpha so that it plays nicely with the renderer.

This applies to both dynamically loaded images and to PNG/GIF data
embedded inside a DefineBitsJPEG tag. This is in contrast to
DefineBitsLossless and DefineBitsJPEG tags w/ alpha, which are
already premultiplied in the SWF.

Also remove unnecessary clamps now that Rust defines casts as
saturating.

Fixes #6559.
2022-03-29 13:41:04 -07:00
Mike Welsh 9c50770c1c avm1: Return Value from `abstract_lt`
All callers converted the result to `Value` anyway.
2022-03-28 19:07:12 -07:00
Mike Welsh 98ea2f81b6 avm1: {} < {} returns false
The Less2 op returns false if the `valueOf` of either parameter
results in an object. The exception is display objects:
`mc < mc` returns undefined.
2022-03-28 19:07:12 -07:00
dependabot[bot] fcb5eaec0e build(deps): bump syn from 1.0.89 to 1.0.90
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.89 to 1.0.90.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.89...1.0.90)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 00:09:22 +03:00
dependabot[bot] bf57d2c15a build(deps): bump jpeg-decoder from 0.2.2 to 0.2.3
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.2.2 to 0.2.3.
- [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/compare/v0.2.2...v0.2.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-29 00:09:01 +03:00
David Wendt b9da107339 core: Refactor `MovieClipLoader` broadcast messages into separate `Loader` associated functions.
These are *not* methods, because we cannot borrow both the update context and the loader at the same time. At least not without making loaders free-standing objects (`GcCell`s), which I don't want to do yet.
2022-03-27 18:55:38 -07:00
David Wendt ac7bb84e08 core: Report unexpected content type errors better. 2022-03-27 18:55:38 -07:00
David Wendt 27697c6611 chore: No, loading an image does not replace the clip with a bitmap. 2022-03-27 18:55:38 -07:00
David Wendt e1d18be7fa core: First pass at image loading through `loadMovie` et all 2022-03-27 18:55:38 -07:00
Toad06 4ad0253076 avm1: `String(function)` returns `[type Function]` 2022-03-27 11:39:44 -07:00
Mike Welsh ac765bd187 chore: Update copyright
I (Michael R. Welsh) assign to Ruffle LLC all rights, title, and
interest to copyrights of my personal contributions to Ruffle,
effective March 26, 2022.
2022-03-26 18:13:14 -07:00
relrelb 1c576816b6 core: Refactor `LoadManager::load_form_into_load_vars`
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb f3c22d930b core: Refactor `LoadManager::load_form_into_object`
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb 83353e17c5 core: Refactor `LoadManager::load_movie_into_clip`
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
relrelb 7e4b3c1003 core: Refactor `LoadManager::load_root_movie`
Make it call `navigator.fetch()` directly rather than receiving an
existing `Future`.
2022-03-26 15:56:06 -07:00
Moulins 1bff5c517a Move back AvmString into ruffle_core::string
This allows removing the gc_arena dependency in ruffle_wstr
2022-03-26 13:42:57 -07:00
Moulins 1911aa9a6b Move core::string into separate ruffle_wstr crate. 2022-03-26 13:42:57 -07:00
relrelb 1230b5e713 swf: Use bitflags for `FontFlag` 2022-03-26 11:33:26 -07:00
relrelb 71a1757d29 swf: Make `Glyph::advance` non-`Option`
Simply use `0` instead of `None`.
2022-03-26 11:33:26 -07:00
relrelb 984342abf3 swf: Avoid some `Vec::resize` usages
Use the `vec![]` macro instead.
2022-03-26 11:33:26 -07:00
dependabot[bot] f9e361ddae build(deps): bump bitstream-io from 1.2.0 to 1.3.0
Bumps [bitstream-io](https://github.com/tuffy/bitstream-io) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/tuffy/bitstream-io/releases)
- [Commits](https://github.com/tuffy/bitstream-io/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 10:52:26 -07:00
dependabot[bot] 0c4806854c build(deps): bump quote from 1.0.16 to 1.0.17
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.16 to 1.0.17.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.16...1.0.17)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 10:30:46 -07:00
relrelb 8f7b8c4b76 xml: Make `XmlNodeData` a struct
The difference between element nodes and text nodes is very minor.
So instead of representing them by two distinct enum members, make
`XmlNodeData` a single unified struct that can represent both. A new
`node_type` field is introduced, in order to still distinguish
between element and text nodes. Also, Ruffle made some incorrect
assumptions, which are now corrected, including:

* Nodes can have any arbitrary `u8` type. This is resolved by the
introduction of the `node_type` field which is a `u8`.
* Text nodes can have children. This is resolved by simply not checking
for text nodes in `append_child` etc.
2022-03-26 10:12:47 -07:00
relrelb 161071e8c4 core: Re-implement `NullExecutor`
Make it a thin abstraction layer over either the `futures` or `wasm-bindgen-futures`
crates, as already done in `render/wgpu/src/uniform_buffer.rs`,
instead of a hand-made single-thread executor.

Ideally this would also be usable on desktop, but I didn't manage to
get `LocalPool` working with `winit` (it needs to post a task to the
`EventLoopProxy` as a wake procedure).
2022-03-26 10:03:42 -07:00
Moulins bb63ac2de7 wstr: fix memory leak
WString's Drop impl didn't actually drop anything
2022-03-25 18:36:00 -07:00
Toad06 c1119fdc0b avm1: Apply autosize to a new `EditText` from an SWF `DefineEditText` tag 2022-03-21 20:00:06 -07:00
Aaron Hill a281db3af6 Add `define_indirect_properties` helper macro for property/slot pairs
In both `FrameLabel` and `Scene`, we define multiple
'public property / private slot' pairs.
The public property has a getter which delegates to the private
property. There is no setter for the property, ensuring that
the private slot can only be modified from within Ruffle itself.

This PR adds a macro `define_indirect_properties` to abstract over
this pattern. Currently, it only supports the read-only property
pattern - however, it could be extended in the future to generate
a setter that invokes a caller-provided callback function.

This needs to be a macro (rather than a method) so that we can
generate a function with the property name hard-coded into it.
Using a closure that references an upvar will not work, since
`Method::from_builtin` requires a function pointer.
2022-03-21 19:00:25 -07:00
relrelb b7a60384cf xml: Inline `update_id_map`
Move its logic to `from_start_event`, where `XmlNode`s are created.
2022-03-20 11:04:48 +02:00
relrelb 724f4165d6 avm1: Implement `nodeName` and `nodeValue` setters
These are actually handled by the same function.
2022-03-19 16:31:24 -07:00
relrelb f9dff4191b xml: Remove `XmlNodeData::DocumentRoot`
Document roots (a.k.a. `XML` objects) are very similar to regular
element nodes (a.k.a. `XMLNode` objects). The primary difference is
that `XML` objects return `null` for their `nodeName`. But this can
be changed too; Setting `xml.nodeName = "someName"` will make `XML`
objects behave much like `XMLNode`. Moreover, many checks in Ruffle
that refuse to operate on document roots were wrong, and actually
these should be accepted as normal element nodes.
Besides the functional corrections, this also simplifies the code.
2022-03-19 16:31:24 -07:00
relrelb fa70cc07ab xml: Inline `text_from_text_event` and `is_whitespace_text` 2022-03-19 15:08:16 -07:00
relrelb b31e826ee6 core: Simplify `SwfMovie` parsing in `Loader`
This also slightly changes behavior: Previously `SwfMovie::from_data`
errors were propagated as `FetchError` and `display_root_movie_download_failed_message`
was called, offering the user to sidestep CORS by opening the SWF
in a new tab. But that wouldn't help, obviously, because no network
error is involved. Now, these errors are propagated as `InvalidSwf`,
and `display_root_movie_download_failed_message` is not called.
2022-03-17 20:31:59 -07:00
relrelb ad944800be core: Perfer `Loader`'s `FetchError`
`NetworkError` and `NetworkUnavailable` were rarely used, and they
were very similar to `FetchError`.
2022-03-17 20:31:59 -07:00
relrelb bf32fc8576 core: Remove unused `Loader` types 2022-03-17 20:31:59 -07:00
dependabot[bot] d56377b166 build(deps): bump quote from 1.0.15 to 1.0.16
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.15 to 1.0.16.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.15...1.0.16)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 20:29:26 -07:00
dependabot[bot] 50bdb40914 build(deps): bump syn from 1.0.87 to 1.0.88
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.87...1.0.88)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 01:00:16 +02:00
dependabot[bot] 7fc6a7c000 build(deps): bump syn from 1.0.87 to 1.0.88
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.87...1.0.88)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-17 00:21:26 +02:00
relrelb 8a17d88c77 core: Remove `NavigatorBackend::time_since_launch`
`core` already depends on the `instant` crate which abstracts
`std::instant::Instant` and polyfills it on Web. Use it to replace
`NavigatorBackend::time_since_launch` in order to make `NavigatorBackend`
a little smaller and more simple.
2022-03-17 00:08:44 +02:00
relrelb 031126a1b8 core: Remove `LocaleBackend`
Previously there were 3 implementations of `LocaleBackend`:
`DesktopLocaleBackend`, `WebLocaleBackend` and `NullLocaleBackend`.

While `DesktopLocaleBackend`, `WebLocaleBackend` were identical,
`NullLocaleBackend` always returned a fixed date/time for tests
determinism.

Unify them in a single file, and use `cfg!(test)` and a new dedicated
`deterministic` feature to decide whether to mock date/time or not.
This should not cause any behavioral changes.
2022-03-16 19:57:53 +02:00
relrelb 1db29217eb chore: Appease clippy 2022-03-16 18:51:39 +02:00
Aaron Hill e87ad52deb avm2: Add initial implementation of `Matrix`
This implements the `a, b, c, d, tx, ty` properties,
as well as the constructor, `identity`, and `scale` methods.
2022-03-16 13:52:58 +02:00
dependabot[bot] 8d7000cd67 build(deps): bump syn from 1.0.86 to 1.0.87
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.86...1.0.87)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-14 22:26:58 +02:00
relrelb f8f2764ac7 chore: Stop using traits available in prelude
This commit does the same as 36353df7f7,
cleaning up any leftovers and new code added since.
2022-03-14 01:16:00 +02:00
relrelb 9c9335dbb8 core: Small cleanup in `Font::measure` 2022-03-13 19:11:06 +02:00
relrelb 3d08f31fa7 avm1: Correct `StageObject::get_level_by_path`
Resolving `_levelN` had some inconsistencies with Flash:
1. `_flash` can be a prefix too.
2. The level ID parsing cannot fail; non-digit characters are ignored,
the value wraps around at `i32::MAX`, and negative values are valid.

This logic is relevant also for the `GetUrl` and `GetUrl2` opcodes.
For now only add TODOs for this.
2022-03-12 16:48:55 +02:00
relrelb b59638935f xml: Remove constant `process_entity` parameter 2022-03-12 16:11:39 +02:00
Aaron Hill 3bcb409bd8 Add more AVM2 'flash.' class stubs
This PR adds the following class stubs:

* 'flash.display.Loader'
* 'flash.net.URLRequest'
* 'flash.ui.Keyboard'
* 'flash.utils.Timer'

These are needed for 'This is the Only Level TOO' (though we'll need
actual implementations to get this game past the loading screen).
2022-03-12 15:09:41 +01:00
relrelb b0a73d5638 avm1: Remove `TransformObject::construct`
`constructor` in `core/src/avm1/globals/transform.rs` should do
the same, as in other built-in classes.
2022-03-12 15:59:05 +02:00
relrelb 5a1e417526 avm1: Simplify `TDisplayObject::avm1_root()`
Make it infailable.
2022-03-10 01:22:52 +02:00
dependabot[bot] 71758be08b build(deps): bump png from 0.17.4 to 0.17.5
Bumps [png](https://github.com/image-rs/image-png) from 0.17.4 to 0.17.5.
- [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.17.4...v0.17.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 23:59:02 +02:00
Aaron Hill f4bb6fc43c Change property definition from `loaderUrl` to `loaderURL`
The actual property name is `loaderURL` - it looks like
a typo was made when this was originally defined in Ruffle.
2022-03-07 09:24:01 +02:00
relrelb 88f6856723 avm1: Fix `isFinite()` for SWF<7
Previously, `isFinite()` with no arguments on SWF<7 incorrectly
returned `true`, as `undefined` coerced to `f64` is `0.0`, which
is finite. Fix this by not defaulting to `undefined`, similarly to
the `isNaN()` implementation.
2022-03-06 23:15:18 +01:00
Aaron Hill 8d58c6974c Display `Muliname` when trying to lookup a non-public property
This will make these errors easier to debug.
2022-03-06 22:56:23 +01:00
Aaron Hill 4a534086b8 Make `Date` class prototype methods non-enumerable 2022-03-06 22:48:15 +01:00
Aaron Hill 2d1b3a2834 Also declare Date methods on class prototype 2022-03-06 22:48:15 +01:00
Aaron Hill 59ef987210 Declare AVM2 'Date' class methods in the AS3 namespace
We now declare these methods in the 'http://adobe.com/AS3/2006/builtin'
namespace. This corresponds to the 'AS3' namespace modifier shown on the
docs page: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html

Previously, we would fail to lookup these methods, since the namespace
used by the SWF would not match the namespace defined by Ruffle.
2022-03-06 22:48:15 +01:00
relrelb 26f3d1e321 avm1: Fix typo 2022-03-06 23:10:09 +02:00
relrelb d0edffaed3 avm1: Remove unneeded `pub` 2022-03-06 23:10:09 +02:00
relrelb 6504dc8ffc avm1: Simplify `MovieClip::get_bounds`
The String and Object cases are already handled by `resolve_target_display_object`.
2022-03-06 23:10:09 +02:00
relrelb 2faabfb58e xml: Remove `Error`
Directly use `quick_xml::Error` instead.
2022-03-02 08:56:23 +02:00
relrelb e901999b4c xml: Silently fail in `insert_child`
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of errors. This
removes the last 3 remaining `Error` enum members besides `InvalidXml`.
2022-03-01 19:56:36 +02:00
relrelb 48d0737cd9 xml: Inline `adopt_child` into `insert_child`
There's no point in calling `adopt_child` alone. This makes 2 `Error`
enum members redundant.
2022-03-01 19:56:36 +02:00
Toad06 dcca61073b core: Display the appropriate mouse cursor after interacting with a button 2022-02-28 15:28:18 -07:00
dependabot[bot] b5f65463b6 build(deps): bump png from 0.17.3 to 0.17.4
Bumps [png](https://github.com/image-rs/image-png) from 0.17.3 to 0.17.4.
- [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>
2022-02-28 22:31:11 +02:00
relrelb 7313913127 xml: Turn `remove_child` into `remove_node`
The 2 existing usages of `remove_node` always operated on a child and
its parent: One iterates over all of its children and removes each one,
and the other explicitly grabs the parent of a given node.

As a simplification, `remove_node` operates only on a child node,
without the need for the parent node in addition; it grabs the parent
from the child by itself. As such, it's non-failable.
2022-02-28 08:34:16 +02:00
relrelb 73c1be8dcc xml: Remove `Error::TextNodeCantHaveChildren`
Text nodes are guaranteed to not be parents, as `adopt_child`
refuses to adopt children into them. So instead of returning an
`Err(Error::TextNodeCantHaveChildren)` in case of a text node parent,
mark those code paths as `unreachable!()`. This makes `orphan_child`
non-failable.
2022-02-28 08:34:16 +02:00
Toad06 66c132017f avm1: Allow strings in `new Sound(target)` 2022-02-28 08:30:38 +02:00
relrelb 0401b3c447 avm2: Replace `json` with `serde_json`
The `json` crate seems unmaintained, and recently also causes compile
errors with stable Rust 1.59.0. On the other hand, `serde_json` is
very maintained and more popular.

However, from some reason a cyclic package dependency has introduced
by this change. For now use a workaround from: https://github.com/tkaitchuck/aHash/issues/95#issuecomment-903560879
2022-02-27 23:19:46 +02:00
relrelb fa459f7547 core: Require `serde` feature
Enable it unconditionally as a preparation for depending on `serde_json`,
which will need `serde::Serialize`.
2022-02-27 23:19:46 +02:00
relrelb 841d0f7efd avm1: Remove legacy JSON SharedObject deserialization
This is basically a revert of 61298b2be3.

`SharedObject`s used to be saved as JSON in Ruffle, but since #4238
they're saved in AMF to match Flash's behavior. The legacy JSON
deserialization remained for backwards-compatibility, but from what it
seems, it has never worked; cd1cde1708
changed `LocalStorageBackend` to store base64-encoded strings instead
of plain ones. Therefore, Ruffle attempts to base64-decode old JSON
data, and unsurprisingly fails.

In addition, this removes 1 out of 2 usages of the unmaintained `json`
crate, which recently also causes compile errors with stable Rust 1.59.0.
2022-02-27 23:19:46 +02:00
relrelb b645c01ce7 xml: Silently fail in `disown_parent`
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of error.
2022-02-24 18:02:52 +02:00
relrelb f7117824df xml: Silently fail in `set_{prev,next}_sibling`
Instead of returning a `Result` which is anyway always handled with
a `log::warn!()`, simply `log::warn!()` in place of errors.
2022-02-23 22:45:07 +02:00
relrelb ce6e90c027 avm1: Store `status` in `XmlObject`, instead of `ParseError`
The only use of `last_parse_error` was in the `XML.prototype.status`
property, where it was converted into a number. Avoid storing it by
storing just the number.
2022-02-21 23:21:14 +02:00
dependabot[bot] 40f356a385 build(deps): bump rand from 0.8.4 to 0.8.5
Bumps [rand](https://github.com/rust-random/rand) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.4...0.8.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 22:34:09 +02:00
Toad06 5e8d8cc4d1 avm1: Add `trace` to globals 2022-02-14 14:50:33 +02:00
relrelb faa1f3d6b4 avm1: Refactor `XmlNodeObject::from_xml_node`
Revert some of e50aea864b for an even
better approach - Remove `XmlNodeObject::empty_node` entirely by
making `XmlNodeObject::from_xml_node` a suitable alternative. That is,
being able to accept a custom `proto` like before.

Also, make it return an `XmlNodeObject` instead of an `Object`, and
add a few `.into()` where needed.
2022-02-14 12:15:39 +02:00
dependabot[bot] db888ad739 build(deps): bump png from 0.17.2 to 0.17.3
Bumps [png](https://github.com/image-rs/image-png) from 0.17.2 to 0.17.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)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 18:43:46 +02:00
relrelb dbddefb44d xml: Refactor `XmlNode::into_string`
* Don't use `quick_xml::Writer` for formatting the XML, being much
more simple.
* Return `WString` instead of `String`, reducing `to_utf8_lossy()`
calls except when the string needs to be escaped (attribute values
and text contents).
2022-02-13 18:11:50 +02:00
dependabot[bot] a3288fa20c build(deps): bump serde from 1.0.133 to 1.0.136
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.133 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.133...v1.0.136)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 18:10:43 +02:00
dependabot[bot] cc2df3e23c build(deps): bump syn from 1.0.85 to 1.0.86
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.85...1.0.86)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:55:17 +01:00
dependabot[bot] 036218ed01 build(deps): bump jpeg-decoder from 0.2.1 to 0.2.2
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.2.1 to 0.2.2.
- [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/compare/v0.2.1...v0.2.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:47:13 +02:00
dependabot[bot] 5f630217c6 build(deps): bump smallvec from 1.7.0 to 1.8.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.7.0...v1.8.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:46:59 +02:00
dependabot[bot] 281c080295 build(deps): bump symphonia from 0.4.0 to 0.5.0
Bumps [symphonia](https://github.com/pdeljanov/Symphonia) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/pdeljanov/Symphonia/releases)
- [Commits](https://github.com/pdeljanov/Symphonia/compare/v0.4.0...v0.5.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 16:13:44 +02:00
dependabot[bot] 3bef5cadf6 build(deps): bump quote from 1.0.14 to 1.0.15
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.14 to 1.0.15.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.14...1.0.15)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 15:45:11 +02:00
Jean Marchand 9969e0ce5a avm2: Fix invalid option 2022-02-12 23:35:32 +02:00
relrelb ad2b8ea007 avm1: Merge `XmlDocument` into `XmlObject`
As `XmlDocument` and `XmlObject` had 1-to-1 relation, and `XmlDocument`
is already tightly coupled with AVM1, there's no good reason for them
being separate objects.

This brings us one step closer towards an XML implementation hosted
completely in AVM1.

A future PR will merge `XmlNode` into `XmlNodeObject` in a similar
manner.
2022-02-11 19:08:02 +02:00
relrelb aee98d81c8 avm1: Fix nightly build error 2022-02-11 18:45:32 +02:00
relrelb 360ad90a85 avm1: Call sort function with a primitive `this`
This is now possible thanks to #6108.
2022-02-11 18:45:32 +02:00
Toad06 b15806d9c2 avm1: Remove `random` from globals 2022-02-11 00:55:13 +02:00
relrelb 44fd13c654 avm1: Fix builtins' attributes
Fixes #5827.
2022-02-10 19:42:05 +02:00
relrelb b6c7cc1ca3 core: Cleanup `Avm1ConstructorRegistry`
Instead of storing shared pointers to `Avm1ConstructorRegistry` in
`MovieLibrary`, access the `PropertyMap` directly, without an extra
abstraction.

Also, move the constructor registries to `Avm1`, for better
encapsulation.
2022-02-10 07:58:30 +02:00
Toad06 fff9cd1d63 avm1: Change cursor to arrow when the `enabled` property is set to false 2022-02-09 16:26:50 -08:00
TÖRÖK Attila ed0aa3758c core: Extend the embedded fake device font with more characters
By also embedding the "Basic Latin", "Latin I", and "Latin Extended A" sections.
2022-02-09 20:09:52 +01:00
relrelb 6c4a10792d avm1: Remove `XmlIdMapObject`
Use a bare `ScriptObject` instead.
2022-02-07 22:24:42 +02:00
relrelb e50aea864b xml: Simplify `XmlNodeObject::from_xml_node`
Since it's always called with the same prototype (`XMLNode.prototype`),
this can be pulled into the function itself, greatly simplifying it.
2022-02-07 22:24:42 +02:00
relrelb 79d5a0e326 avm1: Avoid some calls to `XmlNode::introduce_script_object`
Instead call `XmlNode::script_object`, which internally calls
`XmlNode::introduce_script_object`. This is a preparation for changing
the signature of `XmlNodeObject::from_xml_node`.
2022-02-07 22:24:42 +02:00
relrelb 7e32f7b85d xml: Remove `tests.rs`
These are already covered by the SWF tests.
2022-02-07 22:24:42 +02:00
Adrian Wielgosik 562a205f3d chore: clippy 2022-02-07 00:49:00 +01:00
Adrian Wielgosik 2c4b260a8c chore: cargo fmt 2022-02-07 00:49:00 +01:00
Adrian Wielgosik c67579e236 avm2: Implement Object() 2022-02-07 00:49:00 +01:00
Adrian Wielgosik 0004b9e58e avm2: Implement RegExp() 2022-02-07 00:49:00 +01:00
Adrian Wielgosik c8fe2fcfb2 avm2: Implement Namespace() stub 2022-02-07 00:49:00 +01:00
Adrian Wielgosik 8402f6637b avm2: Implement Vector.<T>(array_like) 2022-02-07 00:49:00 +01:00
Adrian Wielgosik db8aa42db9 avm2: Support custom Class() implementations 2022-02-07 00:49:00 +01:00
Fernando Karchiloff 0c853082dd core: Fix bullet append with box_count check 2022-02-06 20:52:04 +02:00
Fernando Karchiloff b7273e038c core: fix bullet append from html 2022-02-06 20:52:04 +02:00
relrelb 48c43b731e avm1: Remove unused `is_defined` 2022-02-05 13:43:19 +02:00
Toad06 83cc9dc308 avm1: Fire `onReleaseOutside` event even when the button is invisible 2022-01-30 14:08:47 -08:00
Mike Welsh 601918a998 core: Fix drawing API stroke rendering order (fix #3186) 2022-01-29 20:05:04 -08:00
Mike Welsh 705588a2ec core: Fix incorrect fill and stroke rendering order (fix #6129) 2022-01-29 20:05:04 -08:00
Mike Welsh 55da3cd7d0 chore: Add .cargo/config.toml for workspace-level lint config
Currently it is not directly possible to configure lints for the
entire workspace via TOML, which forced us to repeat `#![allow]`
blocks in each crate.

embark pointed out this workaround to configure lints at the
workspace level via RUSTFLAGS:

https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395

Remove the common `#![allow]` blocks and switch to this method for
global lint config.

Temporarily allow `needless_borrow` lint, buggy pending this fix:
https://github.com/rust-lang/rust-clippy/pull/8355
2022-01-29 14:22:44 -08:00
relrelb 99b22b24dd avm1: Remove unused `FunctionObjectData::primitive` 2022-01-29 12:12:39 -08:00
Daniel Jacobs 1e5956c02a core: Fix get_text_format bullet return value 2022-01-27 22:35:18 -08:00
TÖRÖK Attila 43b21e5d4d chore: Bump approx to 0.5.1, remove clippy lint suppressions 2022-01-25 18:34:35 -08:00
Toad06 da50d44460 core: Fix detection of button events 2022-01-24 11:48:37 -08:00
Mike Welsh 354d7f0ce6 avm1: Remove unused `this` from `Scope::resolve` and `set` 2022-01-24 02:04:57 -08:00
Mike Welsh c35edaae82 avm1: Allow `this` to be `undefined`
Change `Activation::this` to be `Value` instead of `Object`.
2022-01-24 02:04:57 -08:00
Mike Welsh 9ccb3ac3e7 avm1: Fix coercion in string-object concatenation
Previously we called `toString` when concatenating a string to an
Object. However, Flash actually has more complex behavior, usually
calling both `valueOf` and `toString`. This is loosely based on
ToPrimitive/DefaultValue with no type hint in the ECMAScript spec.

 * Call `valueOf`.
  * If the result isn't a primitive, call `toString`.
  * If the result still isn't primitive, return `"[type Object]"`.
 * For Date objects in SWFv6 and higher, call `toString`.
  * If the result isn't a primitive, call `toString` (AVM1 bug?)
  * If it still isn't primitive, return `"[type Object]"`.
2022-01-23 17:19:09 -08:00