Commit Graph

2895 Commits

Author SHA1 Message Date
JustinCB a2968d6fd0 web: Change polyfills to single true/false setting 2020-08-13 00:46:58 -07:00
JustinCB f8c40569be i18n: Add Settings Saved to locales 2020-08-13 00:41:23 -07:00
Albert Safin e03373bceb avm1: parseInt 2020-08-13 00:40:20 -07:00
Mike Welsh cbd448522a chore: Allow unknown clippy lints
same_item_push was added on nightly, but is currently throwing
a false negative. I added an allow for it, but this causes a
warning on stable for an unknown lints, so allow unknown lints for
now.
2020-08-12 23:51:12 -07:00
Mike Welsh 6c89869210 chore: Fix clippy lints 2020-08-12 19:04:14 -07:00
JustinCB 5f3aeb91ed chore: Run npm audit fix 2020-08-12 18:55:13 -07:00
dependabot-preview[bot] 9b6dd45439 build(deps): bump smallvec from 1.4.1 to 1.4.2
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.4.1...v1.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-12 11:13:33 -07:00
David Wendt 825eb34c67 avm1: `Button` should not hold write locks on itself when instantiating children.
This fixes a bug where a nested textfield within a button with variable linkages would panic in Ruffle.
2020-08-12 11:08:27 -07:00
David Wendt 354b194b69 avm1: Add test for nested text fields in buttons. 2020-08-12 11:08:27 -07:00
David Wendt 32aad6176b `FunctionObject::from_builtin_constr` should pull the scope and class off of it's given prototype and copy it onto the constructor function it returns. 2020-08-11 00:04:13 -04:00
David Wendt 11ddccfa6a Remove the two-step initialization process and construct an ES4 class for `Object`, `Function`, and `Class`.
This has some particularly annoying consequences for initialization order: notably, we can't actually create any ES4 classes using the standard machinery until after the three objects I just mentioned get created. Ergo, we have to create them through lower-level means, handing prototypes around, and then initialize AVM2's system prototypes list for it.

When we start adding more system prototypes, we'll also have to fill the extras with blank objects and then slot them in as we create them.
2020-08-11 00:02:12 -04:00
David Wendt 16d8c85d20 Load player globals as soon as possible.
We're about to massively change the initialization process, and we really don't want to create another situation where the player can get caught with it's pants down.
2020-08-10 23:35:37 -04:00
David Wendt a8e267ed16 Allow system prototypes to be initialized after the fact. 2020-08-10 23:35:37 -04:00
David Wendt b1bcceaa78 Allow accessing the `Class` off of a constructor or prototype that references it. 2020-08-10 23:35:33 -04:00
David Wendt 22ec96b85e `install_trait` and `install_foreign_trait` should return the value of the thing they installed. 2020-08-10 23:23:35 -04:00
David Wendt df95482eb1 Allow setting `slot_id` or `disp_id` (depending on kind). 2020-08-10 23:23:34 -04:00
David Wendt 4ed5050f56 Add function to change trait attributes. 2020-08-10 23:23:34 -04:00
David Wendt a5b62e833e Add trait attributes, similar to that of class attributes 2020-08-10 23:23:31 -04:00
David Wendt 60d42fa558 Allow creating slot/const traits. 2020-08-10 23:19:22 -04:00
David Wendt 3ca8dfd21a Allow constructing traits for getters, setters, and unbound free functions. 2020-08-10 23:19:22 -04:00
David Wendt d366ceab0e Allow setting the protected namespace of a builtin class. 2020-08-10 23:19:21 -04:00
David Wendt 9dc6cbe1ce Allow creating builtin traits from methods. 2020-08-10 23:19:21 -04:00
David Wendt 5e932bcb75 Allow implementing interfaces in built-in classes. 2020-08-10 23:19:20 -04:00
David Wendt 94d5170277 When manually instantiating classes for globals, make sure that the classes get the global scope object when instantiated. 2020-08-10 23:19:15 -04:00
David Wendt 3585cf983b Convert our stub implementations of all non-ECMA classes into `Class`es.
This was surprisingly tricky - due to the need to look up superclasses, class trait instantiation requires an active `Activation` and `UpdateContext`. We can't get those during VM instance creation, since the player needs the VM first before it can give it a context to work with. Ergo, we have to tear the global scope initialization in two. At the first possible moment, the player calls a new `load_player_globals` method that initializes all class traits in global scope.
2020-08-10 23:16:07 -04:00
David Wendt 6f284f60eb Allow constructing a trait from a class. 2020-08-10 23:09:16 -04:00
David Wendt b0b6cec117 Allow expanding a `QName` into a `Multiname` that selects exactly the `QName` and no more. 2020-08-10 23:09:15 -04:00
David Wendt f09c35c4b9 `From<NativeMethod<'gc>>` doesn't always work, but using an explicit non-trait method sometimes does.
I have no idea why this is necessary - I was in a context where what *should* have been a `NativeMethod<'gc>` was instead being interpreted as some different function type with all the same lifetimes, but with an extra `'gc` lifetime as well. Funneling this through a non-trait method bypasses whatever is going on with the trait solver, and then at that point the trait solver knows what to do. Consider this an extra level of conversion.
2020-08-10 23:09:15 -04:00
David Wendt 4a2a456666 `Class::new` should also take the superclass name. 2020-08-10 23:09:13 -04:00
David Wendt d96596fd8a Add a function to manually change attributes. 2020-08-10 23:07:16 -04:00
David Wendt 44b8e5d9c7 Wrap up the existing sealed/final/interface bits in a `ClassAttributes` enumset. 2020-08-10 23:07:13 -04:00
David Wendt bf6ccfeee1 Add some convenience functions for defining native classes. 2020-08-10 23:02:42 -04:00
dependabot-preview[bot] a96219edbd build(deps): bump serde from 1.0.114 to 1.0.115
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.114 to 1.0.115.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.114...v1.0.115)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-10 16:39:16 -07:00
David Wendt c2cdc302c3 Remove further unnecessary primitive comparison checks 2020-08-10 16:38:04 -07:00
David Wendt 993f56798e Extract all of the numerical conversions into a separate module and leverage them where appropriate in AVM2 2020-08-10 16:38:04 -07:00
David Wendt 566b262d60 Move all our custom object implementations into a separate module, and use a macro to implement them. 2020-08-10 16:38:04 -07:00
David Wendt 5bcd1be270 Remove another instance of `abs` for zero-checks. 2020-08-10 16:38:04 -07:00
David Wendt 2f55c08e37 `pushbyte` should generate signed integers rather than `Number`s. 2020-08-10 16:38:04 -07:00
David Wendt 7f479f24b9 Adjust `coerce_to_string` to be less silly. 2020-08-10 16:38:04 -07:00
David Wendt a12f51903f Non-finite covers everything here. 2020-08-10 16:38:04 -07:00
David Wendt 2e8acfe6f7 Apparantly, Rust already does not care about negative zero, so we don't need to, either. 2020-08-10 16:38:04 -07:00
David Wendt 1bb6f84beb Avoid hitting `coerce_to_number` for integer comparison cases. 2020-08-10 16:38:04 -07:00
David Wendt 4e92352813 Don't promote to `f64` in strict-equality comparisons if we can promote to `i64` instead. 2020-08-10 16:38:04 -07:00
David Wendt a211698464 Handle strict and abstract equality of our various number subtypes as if they were all the same type.
ECMA-262 3rd ed. doesn't mention anything about different number types, so the standard as-if rule applies. If we are going to distinguish number types, we have to treat them as if they were the same type, promoting to `f64` as necessary to facilitate the conversion. I took a cursory look at an ECMA-262 4th ed. draft and it appears to do the same, although it calls everything `GeneralNumber` and has some really confusing psuedo-Pascal syntax for some reason.

I am extremely glad AVM2 does not provide access to 64-bit integer types (for now, at least).
2020-08-10 16:38:04 -07:00
David Wendt f3e47cb596 Further adjustments due to the massive refactor of `Activation`, `AvmX`, and `UpdateContext`. 2020-08-10 16:38:04 -07:00
David Wendt ea4c42a6d1 Split `Value::Number` into separate floating-point, integer, and unsigned representations to match the three numerical classes provided by AS3. 2020-08-10 16:38:04 -07:00
David Wendt a0895e843c Fix `matches!` lint in nightly Rust being tripped. 2020-08-10 16:38:04 -07:00
David Wendt b779dccdc1 Allow objects to provide a coercion hint for cases where a more obvious one is not available. 2020-08-10 16:38:04 -07:00
David Wendt d14fa845c2 Remove `Value::Namespace`.
Namespaces as values adds a bunch of extra special cases to the coercion and equality rules that don't really belong there. Namespace itself just returns it's URI as a string, so we can just make `NamespaceObject` do that and then treat it the same way we treat boxed primitives.
2020-08-10 16:38:04 -07:00
David Wendt e6aac48ae2 Add `NamespaceObject` to hold `Namespace`s.
The reason for this will become very apparent, very shortly.
2020-08-10 16:38:04 -07:00