document cleanup after bad parse start

This commit is contained in:
Karl Seguin committed 2026-09-24 06:17:00 +08:00
1 parent 0016fb0813
commit 4d16a0c4b6
1 file changed
+3
+3
View File
@@ -1163,6 +1163,9 @@ pub fn open(self: *Document, call_frame: *Frame) !*Document {
try frame._script_created_parser_docs.append(frame.arena, self);
}
self._script_created_parser = Parser.Streaming.init(frame.arena, doc_node, frame, .{ .allow_declarative_shadow = true });
// on start() failure the internal `handle` isn't yet create. So we can't
// call done() and we don't want any subsequent cleanup to call done().
errdefer self._script_created_parser = null;
try self._script_created_parser.?.start();
frame._parse_mode = .document;