desktop: Set max_execution_duration to Infinity by default

The `max_execution_duration` feature is pretty much useless on desktop,
and breaks slow SWFs by aborting script execution instead of letting
it continue.
This commit is contained in:
Aaron Hill 2023-07-09 15:33:22 -04:00
parent 3447b8bfdd
commit c19fc1b72c
2 changed files with 8 additions and 2 deletions

View File

@ -44,7 +44,7 @@ pub struct Opt {
pub height: Option<f64>,
/// Maximum number of seconds a script can run before scripting is disabled.
#[clap(long, short, default_value = "15.0")]
#[clap(long, short, default_value = "Infinity")]
pub max_execution_duration: f64,
/// Base directory or URL used to resolve all relative path statements in the SWF file.

View File

@ -129,6 +129,12 @@ impl ActivePlayer {
builder.with_external_interface(Box::<DesktopExternalInterfaceProvider>::default());
}
let max_execution_duration = if opt.max_execution_duration == f64::INFINITY {
Duration::MAX
} else {
Duration::from_secs_f64(opt.max_execution_duration)
};
builder = builder
.with_navigator(navigator)
.with_renderer(renderer)
@ -139,7 +145,7 @@ impl ActivePlayer {
)
.with_autoplay(true)
.with_letterbox(opt.letterbox)
.with_max_execution_duration(Duration::from_secs_f64(opt.max_execution_duration))
.with_max_execution_duration(max_execution_duration)
.with_quality(opt.quality)
.with_warn_on_unsupported_content(opt.warn_on_unsupported_content)
.with_align(opt.align, opt.force_align)