mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:07:47 +00:00
LibWeb: Allow setInterval() with no interval
This commit is contained in:
parent
e3e9749d88
commit
c769784406
1 changed files with 8 additions and 3 deletions
|
@ -135,9 +135,14 @@ JS::Value WindowObject::set_interval(JS::Interpreter& interpreter)
|
||||||
return {};
|
return {};
|
||||||
if (!callback_object->is_function())
|
if (!callback_object->is_function())
|
||||||
return interpreter.throw_exception<JS::TypeError>("Not a function");
|
return interpreter.throw_exception<JS::TypeError>("Not a function");
|
||||||
auto interval = interpreter.argument(1).to_i32(interpreter);
|
|
||||||
if (interpreter.exception())
|
i32 interval = 0;
|
||||||
return {};
|
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);
|
impl->set_interval(*static_cast<JS::Function*>(callback_object), interval);
|
||||||
return JS::js_undefined();
|
return JS::js_undefined();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue