mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
netsurf: expose documentHTMLClose func
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ test {
|
||||
|
||||
// document
|
||||
doc = parser.documentHTMLParse("test.html");
|
||||
defer parser.documentHTMLClose(doc);
|
||||
|
||||
|
||||
// create JS vm
|
||||
const vm = jsruntime.VM.init();
|
||||
|
||||
Reference in New Issue
Block a user