mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-21 20:24:42 +00:00
Don't start request during callback
Fixes a separate but similar issue to https://github.com/lightpanda-io/browser/pull/1689 Specifically, it prevents starting a request from within a libcurl handler, thus avoiding an illegal recursive call. (This commit also removes the failed function call debug logging for DOMExceptions, as these aren't particularly abnormal / log-worthy)
This commit is contained in:
@@ -328,9 +328,13 @@ fn nameToString(local: *const Local, comptime T: type, name: *const v8.Name) !T
|
||||
fn handleError(comptime T: type, comptime F: type, local: *const Local, err: anyerror, info: anytype, comptime opts: CallOpts) void {
|
||||
const isolate = local.isolate;
|
||||
|
||||
if (comptime @import("builtin").mode == .Debug and @TypeOf(info) == FunctionCallbackInfo) {
|
||||
if (log.enabled(.js, .warn)) {
|
||||
logFunctionCallError(local, @typeName(T), @typeName(F), err, info);
|
||||
if (comptime IS_DEBUG and @TypeOf(info) == FunctionCallbackInfo) {
|
||||
if (log.enabled(.js, .debug)) {
|
||||
const DOMException = @import("../webapi/DOMException.zig");
|
||||
if (DOMException.fromError(err) == null) {
|
||||
// This isn't a DOMException, let's log it
|
||||
logFunctionCallError(local, @typeName(T), @typeName(F), err, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +364,7 @@ fn handleError(comptime T: type, comptime F: type, local: *const Local, err: any
|
||||
// this can add as much as 10 seconds of compilation time.
|
||||
fn logFunctionCallError(local: *const Local, type_name: []const u8, func: []const u8, err: anyerror, info: FunctionCallbackInfo) void {
|
||||
const args_dump = serializeFunctionArgs(local, info) catch "failed to serialize args";
|
||||
log.info(.js, "function call error", .{
|
||||
log.debug(.js, "function call error", .{
|
||||
.type = type_name,
|
||||
.func = func,
|
||||
.err = err,
|
||||
|
||||
@@ -496,8 +496,10 @@ fn waitForInterceptedResponse(self: *Client, transfer: *Transfer) !bool {
|
||||
// cases, the interecptor is expected to call resume to continue the transfer
|
||||
// or transfer.abort() to abort it.
|
||||
fn process(self: *Client, transfer: *Transfer) !void {
|
||||
if (self.handles.get()) |conn| {
|
||||
return self.makeRequest(conn, transfer);
|
||||
if (self.handles.performing == false) {
|
||||
if (self.handles.get()) |conn| {
|
||||
return self.makeRequest(conn, transfer);
|
||||
}
|
||||
}
|
||||
|
||||
self.queue.append(&transfer._node);
|
||||
|
||||
Reference in New Issue
Block a user