LibWeb/HTML: Fix crash in window open steps on empty URL string

This commit is contained in:
Shannon Booth 2024-12-11 10:38:16 +13:00 committed by Tim Flynn
parent e4fb25bf63
commit 4b069344e0
Notes: github-actions[bot] 2024-12-11 01:16:57 +00:00
3 changed files with 10 additions and 2 deletions

View file

@ -221,8 +221,8 @@ WebIDL::ExceptionOr<Window::OpenedWindow> Window::window_open_steps_internal(Str
}
// 9. Let noopener be the result of getting noopener for window open with sourceDocument, tokenizedFeatures, and urlRecord.
// FIXME: Is it safe to assume url_record has a value here?
auto no_opener = get_noopener_for_window_open(source_document, tokenized_features, *url_record);
// FIXME: Spec bug: https://github.com/whatwg/html/issues/10844
auto no_opener = get_noopener_for_window_open(source_document, tokenized_features, url_record.has_value() ? *url_record : URL::URL("about:blank"));
// 10. Remove tokenizedFeatures["noopener"] and tokenizedFeatures["noreferrer"].
tokenized_features.remove("noopener"sv);

View file

@ -0,0 +1 @@
PASS! (Didn't crash)

View file

@ -0,0 +1,7 @@
<script src="../include.js"></script>
<script>
test(() => {
window.open();
println("PASS! (Didn't crash)");
})
</script>