Skip to content

Commit

Permalink
avm2: Remove bubbles and cancelable parameters from EventObject::…
Browse files Browse the repository at this point in the history
…progress_event
  • Loading branch information
Lord-McSweeney authored and Lord-McSweeney committed Jan 14, 2025
1 parent ec8f226 commit 3051850
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 27 deletions.
10 changes: 2 additions & 8 deletions core/src/avm2/globals/flash/media/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,8 @@ pub fn load_compressed_data_from_byte_array<'gc>(
Error::RustError(format!("Failed to register sound from bytearray: {e:?}").into())
})?;

let progress_evt = EventObject::progress_event(
activation,
"progress",
bytes.len(),
bytes.len(),
false,
false,
);
let progress_evt =
EventObject::progress_event(activation, "progress", bytes.len(), bytes.len());

Avm2::dispatch_event(activation.context, progress_evt, this);

Expand Down
5 changes: 2 additions & 3 deletions core/src/avm2/globals/flash/net/file_reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,13 @@ pub fn load<'gc>(
let open_evt = EventObject::bare_default_event(activation.context, "open");
Avm2::dispatch_event(activation.context, open_evt, this.into());

let progress_evt = EventObject::progress_event(activation, "progress", 0, size, false, false);
let progress_evt = EventObject::progress_event(activation, "progress", 0, size);
Avm2::dispatch_event(activation.context, progress_evt, this.into());

let open_evt2 = EventObject::bare_default_event(activation.context, "open");
Avm2::dispatch_event(activation.context, open_evt2, this.into());

let progress_evt2 =
EventObject::progress_event(activation, "progress", size, size, false, false);
let progress_evt2 = EventObject::progress_event(activation, "progress", size, size);
Avm2::dispatch_event(activation.context, progress_evt2, this.into());

this.set_loaded(true);
Expand Down
6 changes: 2 additions & 4 deletions core/src/avm2/object/event_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ impl<'gc> EventObject<'gc> {
event_type: S,
bytes_loaded: usize,
bytes_total: usize,
bubbles: bool,
cancelable: bool,
) -> Value<'gc>
where
S: Into<AvmString<'gc>>,
Expand All @@ -296,9 +294,9 @@ impl<'gc> EventObject<'gc> {
&[
event_type.into(),
// bubbles
bubbles.into(),
false.into(),
// cancelable
cancelable.into(),
false.into(),
// bytesLoaded
(bytes_loaded as f64).into(),
// bytesToal
Expand Down
8 changes: 0 additions & 8 deletions core/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1628,8 +1628,6 @@ impl<'gc> Loader<'gc> {
"progress",
total_len,
total_len,
false,
false,
);

Avm2::dispatch_event(activation.context, progress_evt, target);
Expand Down Expand Up @@ -1841,8 +1839,6 @@ impl<'gc> Loader<'gc> {
"progress",
total_len,
total_len,
false,
false,
);

Avm2::dispatch_event(activation.context, progress_evt, sound_object);
Expand Down Expand Up @@ -2379,8 +2375,6 @@ impl<'gc> Loader<'gc> {
"progress",
cur_len,
total_len,
false,
false,
);

Avm2::dispatch_event(uc, progress_evt, loader_info.into());
Expand Down Expand Up @@ -2918,8 +2912,6 @@ impl<'gc> Loader<'gc> {
"progress",
data.len(),
data.len(),
false,
false,
);
Avm2::dispatch_event(
activation.context,
Expand Down
2 changes: 0 additions & 2 deletions core/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1887,8 +1887,6 @@ impl Player {
"progress",
root.compressed_loaded_bytes() as usize,
root.compressed_total_bytes() as usize,
false,
false,
);

Avm2::dispatch_event(context, progress_evt, loader_info);
Expand Down
2 changes: 0 additions & 2 deletions core/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ impl<'gc> Sockets<'gc> {
"socketData",
bytes_loaded,
0, // NOTE: bytesTotal is not used by socketData event.
false,
false,
);

Avm2::dispatch_event(activation.context, progress_evt, target.into());
Expand Down

0 comments on commit 3051850

Please sign in to comment.