mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Noop when document.open is called during iframe parsing
I'm not sure what the correct behavior is, but this fixes a WPT crash: /html/browsers/sandboxing/sandbox-inherited-from-required-csp.html The issue is iframe-specific as, with an iframe, you document.write can be called during parsing when there's no document._current_script (because it's being executed from the parent).
This commit is contained in:
@@ -653,11 +653,13 @@ pub fn write(self: *Document, text: []const []const u8, page: *Page) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (html.len > 0) {
|
if (html.len > 0) {
|
||||||
self._script_created_parser.?.read(html) catch |err| {
|
if (self._script_created_parser) |*parser| {
|
||||||
log.warn(.dom, "document.write parser error", .{ .err = err });
|
parser.read(html) catch |err| {
|
||||||
// was alrady closed
|
log.warn(.dom, "document.write parser error", .{ .err = err });
|
||||||
self._script_created_parser = null;
|
// was alrady closed
|
||||||
};
|
self._script_created_parser = null;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user