mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-24 23:23:58 +00:00
LibWeb: Allow setInterval() with no interval
This commit is contained in:
parent
e3e9749d88
commit
c769784406
Notes:
sideshowbarker
2024-07-19 06:17:16 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/c7697844062 Pull-request: https://github.com/SerenityOS/serenity/pull/2318
1 changed files with 8 additions and 3 deletions
|
@ -135,9 +135,14 @@ JS::Value WindowObject::set_interval(JS::Interpreter& interpreter)
|
|||
return {};
|
||||
if (!callback_object->is_function())
|
||||
return interpreter.throw_exception<JS::TypeError>("Not a function");
|
||||
auto interval = interpreter.argument(1).to_i32(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
i32 interval = 0;
|
||||
if (interpreter.argument_count() >= 2) {
|
||||
interval = interpreter.argument(1).to_i32(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
}
|
||||
|
||||
impl->set_interval(*static_cast<JS::Function*>(callback_object), interval);
|
||||
return JS::js_undefined();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue