mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Set origin of new document in Document.parseHTMLUnsafe()
Previously, a crash would occur when accessing the origin of a document created with this method.
This commit is contained in:
parent
66ca4496c3
commit
b3fa54a791
Notes:
github-actions[bot]
2025-07-06 01:41:08 +00:00
Author: https://github.com/tcl3
Commit: b3fa54a791
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5304
Reviewed-by: https://github.com/shannonbooth ✅
1 changed files with 4 additions and 0 deletions
|
@ -6330,6 +6330,10 @@ GC::Ref<Document> Document::parse_html_unsafe(JS::VM& vm, StringView html)
|
|||
// 4. Parse HTML from a string given document and compliantHTML. // FIXME: Use compliantHTML.
|
||||
document->parse_html_from_a_string(html);
|
||||
|
||||
// AD-HOC: Setting the origin to match that of the associated document matches the behavior of existing browsers.
|
||||
auto& associated_document = as<HTML::Window>(realm.global_object()).associated_document();
|
||||
document->set_origin(associated_document.origin());
|
||||
|
||||
// 5. Return document.
|
||||
return document;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue