1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:45:08 +00:00

LibJS+LibWeb: Clear exceptions after call'ing JavaScript functions

Decorated Interpreter::call() with [[nodiscard]] to provoke thinking
about the returned value at each call site. This is definitely not
perfect and we should really start thinking about slimming down the
public-facing LibJS interpreter API.

Fixes #3136.
This commit is contained in:
Andreas Kling 2020-08-14 17:31:07 +02:00
parent c5127389ca
commit bbe2d4a2d9
7 changed files with 24 additions and 9 deletions

View file

@ -94,7 +94,9 @@ void Window::timer_did_fire(Badge<Timer>, Timer& timer)
}
auto& interpreter = wrapper()->interpreter();
interpreter.call(timer.callback(), wrapper());
(void)interpreter.call(timer.callback(), wrapper());
if (interpreter.exception())
interpreter.clear_exception();
}
i32 Window::allocate_timer_id(Badge<Timer>)
@ -123,7 +125,9 @@ i32 Window::request_animation_frame(JS::Function& callback)
JS::MarkedValueList arguments(interpreter.heap());
arguments.append(JS::Value(fake_timestamp));
fake_timestamp += 10;
interpreter.call(function, {}, move(arguments));
(void)interpreter.call(function, {}, move(arguments));
if (interpreter.exception())
interpreter.clear_exception();
GUI::DisplayLink::unregister_callback(link_id);
});