page: fix page mode when loading about:blank

This commit is contained in:
Pierre Tachoire
2025-10-22 12:08:27 +02:00
parent 43958b81f8
commit a69164b482

View File

@@ -549,11 +549,16 @@ pub const Page = struct {
.body = opts.body != null,
});
// if the url is about:blank, nothing to do.
// if the url is about:blank, we load an empty HTML document in the
// page and dispatch the events.
if (std.mem.eql(u8, "about:blank", request_url)) {
const html_doc = try parser.documentHTMLParseFromStr("");
try self.setDocument(html_doc);
// Assume we parsed the document.
// It's important to force a reset during the following navigation.
self.mode = .parsed;
// We do not processHTMLDoc here as we know we don't have any scripts
// This assumption may be false when CDP Page.addScriptToEvaluateOnNewDocument is implemented
self.documentIsComplete();