mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Change SessionHistoryTraversalQueue to use Promises
If multiple cross-document navigations are queued on SessionHistoryTraversalQueue, running the next entry before the current document load is finished may result in a deadlock. If the new document has a navigable element of its own, it will append steps to SHTQ and hang in nested spin_until. This change uses promises to ensure that the current document loads before the next entry is executed. Fixes timeouts in the imported tests. Co-authored-by: Sam Atkins <sam@ladybird.org>
This commit is contained in:
committed by
Alexander Kalenik
parent
eed4dd3745
commit
50a79c6af8
Notes:
github-actions[bot]
2025-11-26 11:28:29 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/50a79c6af80 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6929
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<iframe id="a"></iframe>
|
||||
<iframe id="b"></iframe>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
let doneA = false, doneB = false;
|
||||
function check() {if (doneA && doneB) done();}
|
||||
function makeContent(id, n) {
|
||||
let html = `<h3>${id} ${n}</h3>`;
|
||||
if (n % 3 === 0) html += `<iframe id="nest1+${id}" srcdoc="${id} ${n}"></iframe>`;
|
||||
if (n % 5 === 0) html += `<frame id="nest2${id} srcdoc="${id} ${n}"/>`;
|
||||
return html;
|
||||
}
|
||||
function run(iframe, id, n, max, finish) {
|
||||
if (n >= max) {println('PASS'); finish(); return;}
|
||||
const blob = new Blob([makeContent(id, n)], {type: 'text/html'});
|
||||
const url = URL.createObjectURL(blob);
|
||||
iframe.onload = () => {
|
||||
try {
|
||||
iframe.contentDocument;
|
||||
URL.revokeObjectURL(url);
|
||||
} catch {println('FAIL'); finish(); return;}
|
||||
run(iframe, id, n + 1, max, finish);
|
||||
};
|
||||
iframe.src = url;
|
||||
}
|
||||
run(document.getElementById('a'), 'a', 0, 101, () => {doneA = true; check();});
|
||||
run(document.getElementById('b'), 'b', 0, 101, () => {doneB = true; check();});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user