netsurf: expose documentHTMLClose func

This commit is contained in:
Pierre Tachoire
2023-10-04 18:20:12 +02:00
parent d4966bea3f
commit 46f01e5286
4 changed files with 9 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ pub fn main() !void {
// document
doc = parser.documentHTMLParse("test.html");
// TODO: defer doc?
defer parser.documentHTMLClose(doc);
// remove socket file of internal server
// reuse_address (SO_REUSEADDR flag) does not seems to work on unix socket

View File

@@ -33,7 +33,7 @@ pub fn main() !void {
// document
doc = parser.documentHTMLParse("test.html");
// TODO: defer doc?
defer parser.documentHTMLClose(doc);
// create JS vm
const vm = jsruntime.VM.init();

View File

@@ -562,6 +562,11 @@ pub fn documentHTMLParse(filename: []const u8) *DocumentHTML {
return @as(*DocumentHTML, @ptrCast(doc.?));
}
// documentHTMLClose closes the document.
pub fn documentHTMLClose(doc: *DocumentHTML) void {
_ = documentHTMLVtable(doc).close.?(doc);
}
pub inline fn documentHTMLToDocument(doc_html: *DocumentHTML) *Document {
return @as(*Document, @ptrCast(doc_html));
}

View File

@@ -39,6 +39,8 @@ test {
// document
doc = parser.documentHTMLParse("test.html");
defer parser.documentHTMLClose(doc);
// create JS vm
const vm = jsruntime.VM.init();