mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
There might be a race between read_all_bytes and stream population. If document load reads stream before it is populated, the stream will be empty and might lead to hang in SessionHistoryTraversalQueue which is expecting a promise to be resolved on document load. This race can occur when stream population and document source are set very close to each other. For example, when a newly generated blob is set as the source of an iframe. - navigation/multiple-navigable-cross-document-navigation.html has been modified to trigger this race.
36 lines
1.5 KiB
HTML
36 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<iframe id="a"></iframe>
|
|
<iframe id="b"></iframe>
|
|
<iframe id="c"></iframe>
|
|
<iframe id="d"></iframe>
|
|
<script>
|
|
asyncTest(done => {
|
|
let doneA = false, doneB = false, doneC = false, doneD = false;
|
|
function check() {if (doneA && doneB && doneC && doneD) 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();});
|
|
run(document.getElementById('c'), 'c', 0, 101, () => {doneC = true; check();});
|
|
run(document.getElementById('d'), 'd', 0, 101, () => {doneD = true; check();});
|
|
});
|
|
</script>
|