mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-07-31 17:55:59 -04:00
Merge pull request #2822 from lightpanda-io/worker_requestAnimationFrame
fix: Crash on requestAnimationFrame from Worker
This commit is contained in:
@@ -193,13 +193,11 @@ const ScheduleCallback = struct {
|
||||
};
|
||||
},
|
||||
.animation_frame => {
|
||||
// requestAnimationFrame is window-only; if a worker ever
|
||||
// schedules with this mode it's a programming error.
|
||||
const window = switch (self.exec.js.global) {
|
||||
.frame => |frame| frame.window,
|
||||
.worker => unreachable,
|
||||
const now = switch (self.exec.js.global) {
|
||||
.frame => |frame| frame.window._performance.now(),
|
||||
.worker => |worker| worker._performance.now(),
|
||||
};
|
||||
ls.toLocal(self.cb).call(void, .{window._performance.now()}) catch |err| {
|
||||
ls.toLocal(self.cb).call(void, .{now}) catch |err| {
|
||||
log.warn(.js, "RAF", .{ .name = self.name, .err = err });
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user