Commit Graph

5613 Commits

Author SHA1 Message Date
relrelb 0a66dac280 avm1: Remove `set` specialization from `impl_custom_object!`
`base_proto` is going to be eliminated in a following commit, so
there will no longer be a difference between the two `set_local`
variants.
2021-10-23 10:51:21 -07:00
Mike Welsh 3fc0209e03 chore: Appease clippy 2021-10-22 22:48:26 -07:00
David Wendt 5abb11482e avm2: Make builtin class prototypes also instances of `Object`, with the sole exception of `Function`, whose prototype is an instance of it's class. 2021-10-22 20:12:48 -07:00
David Wendt 469f8cb9db avm2: All prototypes are instances of `Object`, not their own class. 2021-10-22 20:12:48 -07:00
Adrian Wielgosik c1850d0d54 avm2: Stub flash.net.SharedObject
Just enough for the following to not crash:

```
var so = SharedObject.getLocal("name");
so.data.stuff = "xyz";
so.flush();
trace(so.data.stuff);
```
2021-10-22 10:02:35 -07:00
Chris Midgley ed5d909026 dev: use '' over "" 2021-10-22 11:11:08 +03:00
Mike Welsh 11ae981890 audio: Fix skipping initial frame of MP3 audio
The changes in #5498 caused the samples from the initial MP3 frame
to be skipped. This was noticable in:
https://www.newgrounds.com/portal/view/1

This change properly removes the redundant `num_samples` variable
and considers the samples from the initial MP3 frame.
2021-10-21 10:25:47 -07:00
Adrian Wielgosik 969fab7619 refactor: Stop manually borrowing fields in mutate_with_update_context 2021-10-21 10:24:05 -07:00
Adrian Wielgosik 8cc00f32bb chore: Stop using traits available in prelude 2021-10-21 10:24:05 -07:00
Adrian Wielgosik bc82a4f705 build: Bump Rust edition to 2021 2021-10-21 10:24:05 -07:00
Chris Midgley a9b9d04ec3 dev: use env var over secret 2021-10-21 01:06:04 -07:00
Chris Midgley 4a99dbccba
ci: stop trying to sign Firefox extension again
Skip signing step if extension id secret is unset
2021-10-20 11:15:08 -07:00
EmperorBale 2793c3b556 tests: Add test for getouterscope 2021-10-19 18:39:41 -06:00
EmperorBale 70cbd13201 avm2: Global scope should be null instead of undefined by default 2021-10-19 18:39:41 -06:00
EmperorBale a9f5823074 tests: Add test for with 2021-10-19 18:39:41 -06:00
EmperorBale 903246d5af chore: Appease clippy 2021-10-19 18:39:41 -06:00
EmperorBale ab3ff34944 avm2: Derive Collect for NativeExecutable 2021-10-19 18:39:41 -06:00
EmperorBale 2a84b0cbbb avm2: Instance traits and class traits should use seperate scopechains 2021-10-19 18:39:41 -06:00
EmperorBale 77bf5973a7 chore: Appease clippy 2021-10-19 18:39:41 -06:00
EmperorBale edee0a713c tests: Add test for #5292 2021-10-19 18:39:41 -06:00
EmperorBale 1dd899a76f avm2: Allow small mutations to ScopeChain 2021-10-19 18:39:41 -06:00
EmperorBale 9de7d7ba7a chore: Add todo comment for callstatic 2021-10-19 18:39:41 -06:00
EmperorBale a19488c048 chore: Cleanup comments 2021-10-19 18:39:41 -06:00
EmperorBale d71188e80c avm2: Change code_context to caller_domain 2021-10-19 18:39:41 -06:00
EmperorBale 4667921259 avm2: Push global scope when property is not found 2021-10-19 18:39:41 -06:00
EmperorBale 7e251cfe05 avm2: Add support for pushwith 2021-10-19 18:39:41 -06:00
EmperorBale 388fdbd513 avm2: Scope redesign
avm2: Update scopechain design
2021-10-19 18:39:41 -06:00
dependabot[bot] 40aeffb91d build(deps): bump clap from 3.0.0-beta.4 to 3.0.0-beta.5
Bumps [clap](https://github.com/clap-rs/clap) from 3.0.0-beta.4 to 3.0.0-beta.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/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 14:50:19 -07:00
dependabot[bot] 584323cd15 build(deps): bump isahc from 1.5.0 to 1.5.1
Bumps [isahc](https://github.com/sagebind/isahc) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/sagebind/isahc/releases)
- [Commits](https://github.com/sagebind/isahc/compare/1.5.0...1.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 14:01:38 -07:00
dependabot[bot] 5cab790bd7 build(deps): bump encoding_rs from 0.8.28 to 0.8.29
Bumps [encoding_rs](https://github.com/hsivonen/encoding_rs) from 0.8.28 to 0.8.29.
- [Release notes](https://github.com/hsivonen/encoding_rs/releases)
- [Commits](https://github.com/hsivonen/encoding_rs/compare/v0.8.28...v0.8.29)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 14:01:23 -07:00
dependabot[bot] ca32fe9b90 build(deps): bump gif from 0.11.2 to 0.11.3
Bumps [gif](https://github.com/image-rs/image-gif) from 0.11.2 to 0.11.3.
- [Release notes](https://github.com/image-rs/image-gif/releases)
- [Changelog](https://github.com/image-rs/image-gif/blob/master/Changes.md)
- [Commits](https://github.com/image-rs/image-gif/compare/v0.11.2...v0.11.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 13:43:37 -07:00
dependabot[bot] 4c96891a02 build(deps): bump instant from 0.1.11 to 0.1.12
Bumps [instant](https://github.com/sebcrozet/instant) from 0.1.11 to 0.1.12.
- [Release notes](https://github.com/sebcrozet/instant/releases)
- [Changelog](https://github.com/sebcrozet/instant/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sebcrozet/instant/compare/v0.1.11...v0.1.12)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 13:43:03 -07:00
dependabot[bot] c46e468c11 build(deps): bump lyon from 0.17.5 to 0.17.10
Bumps [lyon](https://github.com/nical/lyon) from 0.17.5 to 0.17.10.
- [Release notes](https://github.com/nical/lyon/releases)
- [Changelog](https://github.com/nical/lyon/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nical/lyon/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 13:42:13 -07:00
Mike Welsh 7745c9137f audio: Grab MP3 sample rate directly from MP3 data
MP3 data in an SWF can be of a different sample rate than
indicated in the SWF tag, so grab the sample rate from the MP3
decoder instead of passing it in from the SWF tag.

Also, a general clean up of the MP3 decoders.

Fixes #335.
2021-10-17 20:34:15 -07:00
Mike Welsh 3dfa5ade18 audio: Ask decoder for sound sample rate
Don't rely on the sample rate in the SWF tags, as this could differ
from the actual sample rate of the audio (see #335).
2021-10-17 20:34:15 -07:00
Toad06 5854d4a23f tests: Don't polyfill files meant to be used as fallback content 2021-10-17 11:44:15 -07:00
Toad06 7f317bca49 web: Don't polyfill files meant to be used as fallback content 2021-10-17 11:44:15 -07:00
Chris Midgley e0b2288005
dev: Set Firefox min version to try to help with signing
* dev: set min Firefox version to 91.1.0
* Revert "dev: don't even try to sign firefox ext"
2021-10-17 11:31:03 -07:00
Mike Welsh 60f5dc2477 avm2: Implement SoundChannel.position
Fix various issues with `SoundChannel`:
 * Change `avm2::Object::as_sound_instance` to `as_sound_channel`.
 * Cache sound position in `SoundChannelObject`.
 * `SoundInfo::in_sample` is in units of 44100Hz.
 * Clamp `num_loops` to 1.
2021-10-16 22:53:25 -07:00
Mike Welsh 6034b4a3af avm1: Sound.position and duration are not version-gated
Even though they were added in SWFv6, they will be available when
playing a v5 SWF in Flash Player 6 and higher.

See #340 for an example in the wild.
2021-10-16 22:53:25 -07:00
Mike Welsh 04d84a3386 web: Implement WebAudioBackend::get_sound_position 2021-10-16 22:53:25 -07:00
Mike Welsh 105c889f5f desktop: Implement AudioBackend::get_sound_position 2021-10-16 22:53:25 -07:00
Mike Welsh bca31b2c51 audio: Grab Sound.position from audio backend
* Change `AudioBackend::get_sound_position` to return `f64` to
   match `AudioBackend::get_sound_duration`.
 * Wire up `AudioBackend::get_sound_position` to `Sound.position`.
 * Remove unimplmeneted warning from `Sound.position`.
2021-10-16 22:53:25 -07:00
relrelb e9efc2841b avm1: Store depth in `SuperObject`
This is a temporary hack to calculate depth from `base_proto` and
`this`, so that changing `this.__proto__` will affect `super`.

In the future, `depth` should be passed instead of `base_proto`.
2021-10-16 11:14:38 -07:00
relrelb 7816938e9b tests: Expand avm1 `SuperObject` tests 2021-10-16 11:14:38 -07:00
relrelb 299b7a778c avm1: Correct `base_proto` for method calls
In case the method is found directly on `this` (normally it shouldn't
because it's usually defined on `this.__proto__`), it seems like the
`super` object behaves identically as-if the method was found on
the object's prototype.
2021-10-16 11:14:38 -07:00
relrelb 7008f9bacc avm1: Correct `base_proto` for constructions
Previously constructions had `base_proto` set to the newly-created
object (`this`). However this doesn't match the `base_proto` of method
calls, which is `this.__proto__` (or more precisely where the function
is found on the prototype chain). This caused wrong behavior when using
the `super` object from within constructors.

Change `base_proto` in that case to be `this.__proto__`, which aligns
with method calls.
In order to keep things working, `SuperObject::call` needs to look-up
one level less than before.

An alternative can be changing `base_proto` for method calls instead,
but that seems to be harder because this would require `search_prototype`
to return the before-last visited object in the prototype chain.
2021-10-16 11:14:38 -07:00
relrelb 1772def6e6 avm1: Fix `SuperObject::get_local_stored`
It should return `None` in order to continue further walking on the
prototype chain.
2021-10-16 11:14:38 -07:00
Chris Midgley c5ad8e76ee
audio: Fail to create invalid ADPCM decoder 2021-10-13 23:12:32 -07:00
Mike Welsh af244c1c66 tests: Add test for function w/ removed base clip 2021-10-12 17:23:01 -07:00