1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:27:45 +00:00

LibWeb: Call requestAnimationFrame() callback with undefined this value

We were leaking an empty value via the callback's this value:

    requestAnimationFrame(function () {
        this; // <-- empty value
    });
This commit is contained in:
Linus Groh 2021-03-26 19:35:54 +01:00 committed by Andreas Kling
parent 49a062f81d
commit 056ffa4abb

View file

@ -140,7 +140,7 @@ i32 Window::request_animation_frame(JS::Function& callback)
auto& function = const_cast<JS::Function&>(static_cast<const JS::Function&>(*handle.cell()));
auto& vm = function.vm();
fake_timestamp += 10;
[[maybe_unused]] auto rc = vm.call(function, {}, JS::Value(fake_timestamp));
[[maybe_unused]] auto rc = vm.call(function, JS::js_undefined(), JS::Value(fake_timestamp));
if (vm.exception())
vm.clear_exception();
GUI::DisplayLink::unregister_callback(link_id);