Commit Graph

6089 Commits

Author SHA1 Message Date
relrelb 0da8e504ab avm1: Correct `MovieClipLoader.loadClip`
Handle strings, numbers and DisplayObject targets (not just MovieClips).
To support non-MovieClip targets, turn `clip.as_movie_clip().unwrap()`
to `if let Some(mc) = clip.as_movie_clip()` in `Loader`.
2022-01-15 13:08:01 -08:00
relrelb e9607cfcbb chore: Appease clippy 2022-01-15 11:16:24 -08:00
relrelb eb52cbd770 ci: Publish npm package before packaging selfhosted
Otherwise `release.zip` is included in the package files.
2022-01-15 11:15:47 -08:00
relrelb 25722e7abe avm1: Fix `onLoadInit` event order
`onLoadInit` is queued after all `DoAction`s of the loaded clips.
That is, if clip1, clip2, clip3 are loaded in the same frame
(in this order), then actions will be executed as follows:

* `DoAction` of clip3
* `DoAction` of clip2
* `DoAction` of clip1
* `onLoadInit` of clip3
* `onLoadInit` of clip2
* `onLoadInit` of clip1

Previously, those were incorrectly executed as follows:

* `DoAction` of clip3
* `onLoadInit` of clip3
* `DoAction` of clip2
* `onLoadInit` of clip2
* `DoAction` of clip1
* `onLoadInit` of clip1
2022-01-14 17:27:14 -08:00
TÖRÖK Attila 12f9bec194 chore: Bump h263-rs git reference
To make use of https://github.com/ruffle-rs/h263-rs/pull/17
2022-01-14 17:09:39 -08:00
Mike Welsh 31443cc9e7 chore: Publish npm package publicly 2022-01-14 16:01:23 -08:00
TÖRÖK Attila 483028707f web: Add custom profiles to separate the build cache for the two wasm modules 2022-01-13 12:28:00 -08:00
relrelb 5f033743f0 web: Mark packages as private
This prevents accidental publication of packages that shouldn't
be published. Some packages were already marked as such, so it's a
bit more consistent.
2022-01-12 21:24:19 -08:00
relrelb 7cffddca97 extension: Fix typo
We actually append the build number (the `BUILD_ID` environment variable,
which originates from `github.run_number` in the CI), not the build date.
2022-01-12 21:24:19 -08:00
relrelb 38549fdbdf web: Publish NPM package
Publish nightly releases as part of the CI, so Ruffle can be easily
integrated into a website using a CDN (such as jsDelivr). It would
also be easier for websites to keep up-to-date, as NPM auto-updates
the `latest` tag to refer to the latest release.

A dedicated `package.json` is used for the published NPM package,
because `ruffle-selfhosted` depends on the private `ruffle-core`
package, which shouldn't be published.

Also, the `version` field must monotonically increase. So Webpack
auto-fills it to be `0.1.0-nightly.YYYY.MM.DD`. This format satisfies
a couple of needs:
* Newer nightly releases should take precedence over older ones.
* Stable releases (e.g. `1.0.0`) should take precedence over nightly
ones.
2022-01-12 21:24:19 -08:00
relrelb 3f8f117fd3 web: Convert .eslintrc files from JSON to YAML
YAML is shorter, more modern, readable, and flexible than JSON.
In other words, YAML >>> JSON.

Auto-converted using [`yq`](https://github.com/kislyuk/yq).
2022-01-12 20:10:00 -08:00
Mike Welsh 70bb5fa3f2 extension: Change unsafe-eval to wasm-eval in CSP
`unsafe-eval` was needed in the extension Content Security
Policy to Wasm compilation in Chrome.

This CSP setting causes the extension to get flagged in the
Mozilla Add-On Marketplace, which discourages the use of
`unsafe-eval`.

However, Chrome has a `wasm-eval` CSP setting which also allows
extensions to compile Wasm without requiring `unsafe-eval`.
Inject this into the extension manifest when building the Chrome
extension.

Eventually this may change to `wasm-unsafe-eval` as drafted by
the CSP spec and be required by all browsers.
2022-01-12 11:29:36 -08:00
TÖRÖK Attila db6731be2c web: Detect and log whether WebAssembly extensions are actually used 2022-01-12 11:29:16 -08:00
TÖRÖK Attila 44e59a0012 web,ci: Only build the vanilla module by default, use it as stand-in for the other
And enable the module that really uses WebAssembly extensions for the
releases by running the new "npm run build:dual-wasm" command, which
sets the ENABLE_WASM_EXTENSIONS=true environment variable.
2022-01-12 11:29:16 -08:00
TÖRÖK Attila ab69c12649 web: Build two WASM modules, with/without extensions, load the appropriate one 2022-01-12 11:29:16 -08:00
relrelb c4d013c884 ci: Cache npm dependencies
This should improve CI build times.

Done as described in:
https://github.com/actions/setup-node#caching-packages-dependencies
2022-01-12 10:30:51 -08:00
relrelb 7f4f40621b web: Migrate to npm workspaces
`lerna` is a bit stale, and as such it currently has some outdated
dependencies which Dependabot warns on.
Fortunately, npm 7 supports monorepos natively, via "workspaces". So
simply replace `lerna` with this feature. The migration is pretty
neat and requires a very little invervention.

Because Node.js 14 comes with npm 6 by default, upgrade it manually
as shown in https://github.com/bahmutov/npm-install/issues/103#issuecomment-931226602.
2022-01-11 13:17:48 -08:00
dependabot[bot] 50d6b48946 build(deps): bump clap from 3.0.1 to 3.0.6
Bumps [clap](https://github.com/clap-rs/clap) from 3.0.1 to 3.0.6.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v3.0.1...v3.0.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 00:32:55 -08:00
dependabot[bot] 3eea49ef47 build(deps): bump enum-map from 1.1.1 to 2.0.0
Bumps [enum-map](https://gitlab.com/KonradBorowski/enum-map) from 1.1.1 to 2.0.0.
- [Release notes](https://gitlab.com/KonradBorowski/enum-map/tags)
- [Changelog](https://gitlab.com/KonradBorowski/enum-map/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/KonradBorowski/enum-map/commits/master)

---
updated-dependencies:
- dependency-name: enum-map
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 00:05:23 -08:00
Mike Welsh 232f1dd120 chore: Appease clippy 2022-01-10 23:37:11 -08:00
dependabot[bot] 8f53449762 build(deps): bump indexmap from 1.7.0 to 1.8.0
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.rst)
- [Commits](https://github.com/bluss/indexmap/compare/1.7.0...1.8.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:08:19 -08:00
dependabot[bot] e459677eaa build(deps): bump sha2 from 0.10.0 to 0.10.1
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.10.0 to 0.10.1.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.10.0...sha2-v0.10.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:07:50 -08:00
dependabot[bot] 491cc05a79 build(deps): bump syn from 1.0.84 to 1.0.85
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.84 to 1.0.85.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.84...1.0.85)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:07:29 -08:00
dependabot[bot] 426bb56fb9 build(deps): bump clap from 3.0.1 to 3.0.5
Bumps [clap](https://github.com/clap-rs/clap) from 3.0.1 to 3.0.5.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v3.0.1...v3.0.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:05:12 -08:00
dependabot[bot] 33db3e2d86 build(deps): bump crossbeam-channel from 0.5.1 to 0.5.2
Bumps [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-channel-0.5.1...crossbeam-channel-0.5.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:04:41 -08:00
dependabot[bot] e5497e3351 build(deps): bump winit from 0.26.0 to 0.26.1
Bumps [winit](https://github.com/rust-windowing/winit) from 0.26.0 to 0.26.1.
- [Release notes](https://github.com/rust-windowing/winit/releases)
- [Changelog](https://github.com/rust-windowing/winit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-windowing/winit/compare/v0.26.0...v0.26.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:04:28 -08:00
dependabot[bot] 807b22eabd build(deps): bump tinyfiledialogs from 3.8.3 to 3.9.0
Bumps [tinyfiledialogs](https://github.com/jdm/tinyfiledialogs-rs) from 3.8.3 to 3.9.0.
- [Release notes](https://github.com/jdm/tinyfiledialogs-rs/releases)
- [Commits](https://github.com/jdm/tinyfiledialogs-rs/commits/v3.9.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 22:04:10 -08:00
relrelb b39ab9034c core: Remove `Player::is_mouse_down`
Now that `InputManager` tracks the mouse button, it can be used
instead.
2022-01-10 01:18:49 -08:00
relrelb 573aa89c9a core: Handle mouse events in `InputManager::handle_event` 2022-01-10 01:18:49 -08:00
relrelb 82b4c6ef27 core: Support mouse buttons in `KeyCode`
Add `MouseLeft`, `MouseRight` and `MouseMiddle` to `KeyCode` for
AVM1's `Key.isDown()` function.
2022-01-10 01:18:49 -08:00
relrelb 6396c21bc0 core: Rename `PlayerEvent::MouseLeft` to `MouseLeave`
So it's not consfusing with `KeyCode::MouseLeft`.
2022-01-10 01:18:49 -08:00
relrelb c00532aed2 core: Cleanup mouse update logic
Move code that is exclusive to mouse events from
`Player::update_mouse_state` to `Player::handle_event`.
2022-01-10 01:18:49 -08:00
Adrian Wielgosik 86210363f0 avm2: Remove Object::derive() machinery for AS3 prototypes 2022-01-09 18:23:10 -08:00
relrelb b79144c122 avm1: Remove `TextFormatObject::set_text_format`
Use `text_format_mut` instead.
2022-01-10 00:26:33 +02:00
Mike Welsh bb3ef68499 web: Handle gaps in MP3 SoundStreamBlock tags 2022-01-07 13:23:53 -08:00
Mike Welsh 2653c5f5c3 audio: Handle gaps in MP3 SoundStreamBlock tags (fix #3817)
An MP3 "stream" sound can sometimes have frames without a
SoundStreamBlock tag, despite the SWF spec saying there should
at least be a tag with 0 samples on each frame. Ruffle would
stop the sound in this case, but the Flash Player may or may not
stop thje sound in the audio depending on the number of "empty"
frames. This could cause the audio to stutter as it continuously
stopped and restarted.

Handle this by keeping track of how many samples we've encountered
in MP3 blocks, and deducting the amount of samples consumed by each
timeline frame. Stop the sound if we run out of samples, as opposed
to when we hit a frame without a SoundStreamBlock.

Fixes #3817.
2022-01-07 13:23:53 -08:00
Mike Welsh b2f7c98f88 audio: Sync animation with embedded audio streams
This is a first pass at syncing animation and audio playback when
and embedded audio stream is playing.

Fixes #3020, #3663, #3958.
2022-01-07 13:23:53 -08:00
relrelb 6b80b296fc tests: Expand `mcl_loadclip` 2022-01-07 10:39:16 -08:00
relrelb 8c736b9756 avm1: Fix `MovieClipLoader` event arguments
The first argument of all events is the target MovieClip. It was
incorrect.

Also, `onLoadComplete` accepts an additional `httpStatus` argument.
Stub it to 0.
2022-01-07 10:39:16 -08:00
relrelb e045a9502b core: Small cleanup in `Loader`
Remove unnecessary calls to `introduce_loader_handle`, which are
dominated by `add_loader` that already calls it. As a result, `add_loader`
remained the only function to call `introduce_loader_handle`, so inline
it there.
2022-01-07 10:39:16 -08:00
relrelb c05ff4cbc8 core: Unify `Loader::Xml` into `Loader::LoadVars`
Since they are identical (they both load the URL as a string, then
fire the `onHTTPStatus` and `onData` events). In fact, AVM1's
`XML.prototype.load` and `LoadVars.prototype.load` functions are
both defined as `ASnative(301, 0)`, so they invoke the same native
code under the hood.
2022-01-07 09:51:27 -08:00
dependabot[bot] a9e86a73cf build(deps): bump serde from 1.0.132 to 1.0.133
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.132 to 1.0.133.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.132...v1.0.133)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 23:28:57 +02:00
dependabot[bot] 6533511994 build(deps): bump quote from 1.0.10 to 1.0.14
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.10 to 1.0.14.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.10...1.0.14)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 22:50:58 +02:00
dependabot[bot] 86d2e1ddba build(deps): bump clap from 3.0.0-rc.8 to 3.0.1
Bumps [clap](https://github.com/clap-rs/clap) from 3.0.0-rc.8 to 3.0.1.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_generate-v3.0.0-rc.8...clap_complete-v3.0.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-03 22:50:45 +02:00
Mike Welsh 3010c505aa chore: Add error-report issue template
The `error-report` label was not being added to error reports
submitted by panics in the web player, despite the `labels` query
parameter in the URL. Users do not have triage/write access to the
repo, which is required by GitHub to add a label to an issue.

Add an issue template for error reports with the `error-report`
label. This template is now added to the issue URL, which
automatically adds the tag regardless of access level.
2022-01-02 13:59:54 -08:00
Mike Welsh ab88f9a23e tests: Add test case for #5598 2022-01-01 22:24:08 -08:00
Mike Welsh 34ed9cbbaa core: Fix incorrect closing of paths in drawing API (fix #5598)
The path starting position was not being set correctly after a
moveTo command, which could cause stray strokes to appear in the
drawing.

Fixes #5598, #5768, #5957.
2022-01-01 22:24:08 -08:00
relrelb 655adedc1c xml: Remove `XmlNode::is_as2_compatible`
Now all `XmlNodeData` types are AS2-compatible, so `is_as2_compatible`
always returns `true`.
2022-01-02 07:36:49 +02:00
relrelb 30cd2aa4f1 xml: Remove `XmlNodeData::DocType`
`XmlNode::is_as2_compatible` returns `false` for `XmlNodeData::DocType`
nodes, which means they are not included in string representations of
XML documents, and they cannot be traversed using the DOM methods.

So don't create those when parsing an XML from string, but still
store the `DOCTYPE` declaration string on the `XmlDocument`, which
is accissible through the `.docTypeDecl` property.
2022-01-02 07:36:49 +02:00
relrelb 827bb6e48e xml: Remove `XmlNodeData::Comment`
`XmlNode::is_as2_compatible` returns `false` for `XmlNodeData::Comment`
nodes, which means they are not included in string representations of
XML documents, and they cannot be traversed using the DOM methods.

So simply don't create those when parsing an XML from string.
2022-01-02 07:36:49 +02:00