mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-09-15 15:32:03 -04:00
Merge pull request #3456 from lightpanda-io/fix-v8-reentrancy-in-window
Fix V8 Reentry on unhandled promise
This commit is contained in:
1 file changed
+9
@@ -1548,6 +1548,15 @@ pub fn createPromiseResolver(self: *const Local) js.PromiseResolver {
|
||||
}
|
||||
|
||||
pub fn debugValue(self: *const Local, js_val: js.Value, writer: *std.Io.Writer) !void {
|
||||
// _debugValue walks arbitrary, caller-supplied object graphs (e.g. a
|
||||
// rejected promise's reason) via raw property gets. A getter or Proxy
|
||||
// trap encountered along the way can throw; without a TryCatch here,
|
||||
// that leaves the isolate's exception flag set after we return, and the
|
||||
// next unrelated JS entry point trips V8's has_exception() debug check.
|
||||
var try_catch: js.TryCatch = undefined;
|
||||
try_catch.init(self);
|
||||
defer try_catch.deinit();
|
||||
|
||||
var seen: std.AutoHashMapUnmanaged(u32, void) = .empty;
|
||||
return self._debugValue(js_val, &seen, 0, writer) catch error.WriteFailed;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user