mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-24 23:23:58 +00:00
LibWeb: Enforce set{Interval,Timeout}() min interval of 0
This commit is contained in:
parent
c769784406
commit
b962728c4e
Notes:
sideshowbarker
2024-07-19 06:17:13 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/b962728c4e1 Pull-request: https://github.com/SerenityOS/serenity/pull/2318
1 changed files with 4 additions and 0 deletions
|
@ -141,6 +141,8 @@ JS::Value WindowObject::set_interval(JS::Interpreter& interpreter)
|
|||
interval = interpreter.argument(1).to_i32(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
if (interval < 0)
|
||||
interval = 0;
|
||||
}
|
||||
|
||||
impl->set_interval(*static_cast<JS::Function*>(callback_object), interval);
|
||||
|
@ -165,6 +167,8 @@ JS::Value WindowObject::set_timeout(JS::Interpreter& interpreter)
|
|||
interval = interpreter.argument(1).to_i32(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
if (interval < 0)
|
||||
interval = 0;
|
||||
}
|
||||
|
||||
impl->set_timeout(*static_cast<JS::Function*>(callback_object), interval);
|
||||
|
|
Loading…
Reference in a new issue