From 3db4b0b61ba15e0372935b3dc8c63072e8cdb62b Mon Sep 17 00:00:00 2001 From: Muki Kiboigo Date: Thu, 2 Apr 2026 03:26:02 -0700 Subject: [PATCH] move script queue log before request --- src/browser/ScriptManager.zig | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/browser/ScriptManager.zig b/src/browser/ScriptManager.zig index c7901e9e..546a05c5 100644 --- a/src/browser/ScriptManager.zig +++ b/src/browser/ScriptManager.zig @@ -273,7 +273,19 @@ pub fn addFromElement(self: *ScriptManager, comptime from_parser: bool, script_e // Let the outer errdefer handle releasing the arena if client.request fails } - // If we return synchronously (like from cache), we would call evaluate() immediately. + if (comptime IS_DEBUG) { + var ls: js.Local.Scope = undefined; + page.js.localScope(&ls); + defer ls.deinit(); + + log.debug(.http, "script queue", .{ + .ctx = ctx, + .url = remote_url.?, + .element = element, + .stack = ls.local.stackTrace() catch "???", + }); + } + { const was_evaluating = self.is_evaluating; self.is_evaluating = true; @@ -299,19 +311,6 @@ pub fn addFromElement(self: *ScriptManager, comptime from_parser: bool, script_e } handover = true; - - if (comptime IS_DEBUG) { - var ls: js.Local.Scope = undefined; - page.js.localScope(&ls); - defer ls.deinit(); - - log.debug(.http, "script queue", .{ - .ctx = ctx, - .url = remote_url.?, - .element = element, - .stack = ls.local.stackTrace() catch "???", - }); - } } if (is_blocking == false) {