Merge pull request #189 from lightpanda-io/browser-set-document-uri

browser: inject document URL
This commit is contained in:
Pierre Tachoire
2024-02-29 15:47:06 +01:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -224,7 +224,9 @@ pub const Page = struct {
// TODO set document.readyState to interactive
// https://html.spec.whatwg.org/#reporting-document-loading-status
// TODO inject the URL to the document including the fragment.
// inject the URL to the document including the fragment.
try parser.documentSetDocumentURI(doc, self.rawuri orelse "about:blank");
// TODO set the referrer to the document.
self.session.window.replaceDocument(doc);

View File

@@ -1653,6 +1653,11 @@ pub inline fn documentGetDocumentURI(doc: *Document) ![]const u8 {
return strToData(s.?);
}
pub fn documentSetDocumentURI(doc: *Document, uri: []const u8) !void {
const err = documentVtable(doc).dom_document_set_uri.?(doc, try strFromData(uri));
try DOMErr(err);
}
pub inline fn documentGetInputEncoding(doc: *Document) ![]const u8 {
var s: ?*String = undefined;
const err = documentVtable(doc).dom_document_get_input_encoding.?(doc, &s);