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:
parent
3447b8bfdd
commit
c19fc1b72c
|
@ -44,7 +44,7 @@ pub struct Opt {
|
||||||
pub height: Option<f64>,
|
pub height: Option<f64>,
|
||||||
|
|
||||||
/// Maximum number of seconds a script can run before scripting is disabled.
|
/// 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,
|
pub max_execution_duration: f64,
|
||||||
|
|
||||||
/// Base directory or URL used to resolve all relative path statements in the SWF file.
|
/// Base directory or URL used to resolve all relative path statements in the SWF file.
|
||||||
|
|
|
@ -129,6 +129,12 @@ impl ActivePlayer {
|
||||||
builder.with_external_interface(Box::<DesktopExternalInterfaceProvider>::default());
|
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
|
builder = builder
|
||||||
.with_navigator(navigator)
|
.with_navigator(navigator)
|
||||||
.with_renderer(renderer)
|
.with_renderer(renderer)
|
||||||
|
@ -139,7 +145,7 @@ impl ActivePlayer {
|
||||||
)
|
)
|
||||||
.with_autoplay(true)
|
.with_autoplay(true)
|
||||||
.with_letterbox(opt.letterbox)
|
.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_quality(opt.quality)
|
||||||
.with_warn_on_unsupported_content(opt.warn_on_unsupported_content)
|
.with_warn_on_unsupported_content(opt.warn_on_unsupported_content)
|
||||||
.with_align(opt.align, opt.force_align)
|
.with_align(opt.align, opt.force_align)
|
||||||
|
|
Loading…
Reference in New Issue