Skip to content

Commit 3f31573

Browse files
committed
No need to navigate to about:blank
1 parent 967ab18 commit 3f31573

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/cdp/domains/target.zig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ fn createTarget(cmd: anytype) !void {
125125
bc.target_id = target_id;
126126

127127
var page = try bc.session.createPage();
128-
// Navigate to about:blank such that the window.document are created and set
129-
const url = @import("../../url.zig").URL.about_blank;
130-
try page.navigate(url, .{});
131128
{
132129
const aux_data = try std.fmt.allocPrint(cmd.arena, "{{\"isDefault\":true,\"type\":\"default\",\"frameId\":\"{s}\"}}", .{target_id});
133130
bc.inspector.contextCreated(
@@ -504,10 +501,6 @@ test "cdp.target: createTarget" {
504501
// should create a browser context
505502
const bc = ctx.cdp().browser_context.?;
506503
try ctx.expectSentEvent("Target.targetCreated", .{ .targetInfo = .{ .url = "about:blank", .title = "about:blank", .attached = false, .type = "page", .canAccessOpener = false, .browserContextId = bc.id, .targetId = bc.target_id.? } }, .{});
507-
508-
// Even about:blank should set the window.document
509-
const page = ctx.cdp().browser_context.?.session.page.?;
510-
try testing.expect(page.window.document != null);
511504
}
512505

513506
{

src/cdp/testing.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const TestContext = struct {
123123
if (bc.session_id == null) bc.session_id = "SID-X";
124124
parser.deinit();
125125
const page = try bc.session.createPage();
126-
page.doc = (try Document.init(html)).doc;
126+
page.window.document = (try Document.init(html)).doc;
127127
}
128128
return bc;
129129
}

src/testing.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ pub const Random = struct {
207207
};
208208

209209
pub const Document = struct {
210-
doc: *parser.Document,
210+
doc: *parser.DocumentHTML,
211211
arena: std.heap.ArenaAllocator,
212212

213213
pub fn init(html: []const u8) !Document {
@@ -219,7 +219,7 @@ pub const Document = struct {
219219

220220
return .{
221221
.arena = std.heap.ArenaAllocator.init(allocator),
222-
.doc = parser.documentHTMLToDocument(html_doc),
222+
.doc = html_doc,
223223
};
224224
}
225225

@@ -240,7 +240,7 @@ pub const Document = struct {
240240
}
241241

242242
pub fn asNode(self: *const Document) *parser.Node {
243-
return parser.documentToNode(self.doc);
243+
return parser.documentHTMLToNode(self.doc);
244244
}
245245
};
246246

0 commit comments

Comments
 (0)