SWFv5 always calls `Object.valueOf` at least once and sometimes
twice in the Equals2 op, even when comparing two Objects.
For example, `Object(1) == Object(1)` is true in SWFv5 but false
in SWFv6.
Consolidate several cases and fix some issues:
* Object-to-primitive comparison always goes through `valueOf`.
* `Object(undefined) == undefined` is true; this will coerce
to a bare object with no `valueOf`, resulting in
`undefined==undefined`.
* `{valueOf:function() { return NaN; }} == NaN` is true.
When creating a scope for a closure, any `with` scopes were being
filtered out, but this was incorrect; `with` scopes are still on
the scope chain when the function is called.
Flash ignores mismatched end tags (i.e. end tags with a missing/different
corresponding start tag). `quick-xml` checks end tag mismatches by
default, but it cannot recover after encountering one.
Commit 7e20543578 already disabled
`quick-xml`'s check, but that caused mismatched `Event::End` to be
handled, which may empty `format_stack` and later panic on
`format_stack.last().unwrap()`.
Thus, check for mismatched end tags ourselves, in a similar manner
of `quick-xml`, but in a recoverable way.
* Have `DefineFunction` and `DefineFunction2` go through the same
code path by implementing `From<DefineFunction>` for
`DefineFunction2`.
* Change `register` to a `Option<NonZeroU8>` for size optimization.
* Add `function::Param` to store param info instead of a tuple.
Use a struct for all variants of `avm1::Action`.
This makes the style more consistent instead of using a mix of
struct and tuple variants, and allows the data to be easily passed
around.
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`.
`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
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.