mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Merge pull request #50 from Browsercore/parsedocument-idiomatic
netsurf: use idiomatic []const u8 for filename
This commit is contained in:
@@ -53,8 +53,7 @@ pub fn main() !void {
|
|||||||
defer vm.deinit();
|
defer vm.deinit();
|
||||||
|
|
||||||
// document
|
// document
|
||||||
var f = "test.html".*;
|
doc = parser.documentHTMLParse("test.html");
|
||||||
doc = parser.documentHTMLParse(&f);
|
|
||||||
// TODO: defer doc?
|
// TODO: defer doc?
|
||||||
|
|
||||||
// remove socket file of internal server
|
// remove socket file of internal server
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ pub fn main() !void {
|
|||||||
const apis = jsruntime.compile(DOM.Interfaces);
|
const apis = jsruntime.compile(DOM.Interfaces);
|
||||||
|
|
||||||
// document
|
// document
|
||||||
var f = "test.html".*;
|
doc = parser.documentHTMLParse("test.html");
|
||||||
doc = parser.documentHTMLParse(&f);
|
|
||||||
// TODO: defer doc?
|
// TODO: defer doc?
|
||||||
|
|
||||||
// create JS vm
|
// create JS vm
|
||||||
|
|||||||
@@ -553,8 +553,9 @@ fn documentHTMLVtable(doc_html: *DocumentHTML) c.dom_html_document_vtable {
|
|||||||
return getVtable(c.dom_html_document_vtable, DocumentHTML, doc_html);
|
return getVtable(c.dom_html_document_vtable, DocumentHTML, doc_html);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn documentHTMLParse(filename: []u8) *DocumentHTML {
|
pub fn documentHTMLParse(filename: []const u8) *DocumentHTML {
|
||||||
const doc = c.wr_create_doc_dom_from_file(filename.ptr);
|
var f: []u8 = @constCast(filename);
|
||||||
|
const doc = c.wr_create_doc_dom_from_file(f.ptr);
|
||||||
if (doc == null) {
|
if (doc == null) {
|
||||||
@panic("error parser");
|
@panic("error parser");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,7 @@ test {
|
|||||||
const apis = jsruntime.compile(DOM.Interfaces);
|
const apis = jsruntime.compile(DOM.Interfaces);
|
||||||
|
|
||||||
// document
|
// document
|
||||||
var f = "test.html".*;
|
doc = parser.documentHTMLParse("test.html");
|
||||||
doc = parser.documentHTMLParse(&f);
|
|
||||||
|
|
||||||
// create JS vm
|
// create JS vm
|
||||||
const vm = jsruntime.VM.init();
|
const vm = jsruntime.VM.init();
|
||||||
|
|||||||
Reference in New Issue
Block a user