mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Check if navigable has active window before navigating
Fixes https://github.com/LadybirdBrowser/ladybird/issues/3733
This commit is contained in:
parent
ea3b7efd91
commit
0f697193f0
Notes:
github-actions[bot]
2025-02-28 22:16:27 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/0f697193f0e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3735
3 changed files with 26 additions and 0 deletions
|
@ -1342,6 +1342,10 @@ WebIDL::ExceptionOr<void> Navigable::populate_session_history_entry_document(
|
|||
|
||||
WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
|
||||
{
|
||||
// AD-HOC: Not in the spec but subsequent steps will fail if the navigable doesn't have an active window.
|
||||
if (!active_window())
|
||||
return {};
|
||||
|
||||
auto source_document = params.source_document;
|
||||
auto exceptions_enabled = params.exceptions_enabled;
|
||||
auto& active_document = *this->active_document();
|
||||
|
|
1
Tests/LibWeb/Assets/blank.html
Normal file
1
Tests/LibWeb/Assets/blank.html
Normal file
|
@ -0,0 +1 @@
|
|||
<div>blank page</div>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<body></body>
|
||||
<script>
|
||||
function test(name) {
|
||||
const form = document.body.appendChild(document.createElement("form"));
|
||||
const target = document.createElement("iframe");
|
||||
target.name = name;
|
||||
form.action = "../../Assets/blank.html";
|
||||
document.body.appendChild(target);
|
||||
form.target = target.name;
|
||||
form.submit();
|
||||
target.addEventListener("load", () => {
|
||||
document.body.removeChild(form);
|
||||
document.body.removeChild(target);
|
||||
});
|
||||
}
|
||||
test("1");
|
||||
test("2");
|
||||
test("3");
|
||||
</script>
|
Loading…
Add table
Reference in a new issue