mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
In high concurrency, sometimes 400+ blob urls and iframe loads take longer than 30 seconds, especially on sanitizer runs when memory is tight. Reduce the number of urls and iframes to 84.
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, 21, () => {doneA = true; check();});
|
|
run(document.getElementById('b'), 'b', 0, 21, () => {doneB = true; check();});
|
|
run(document.getElementById('c'), 'c', 0, 21, () => {doneC = true; check();});
|
|
run(document.getElementById('d'), 'd', 0, 21, () => {doneD = true; check();});
|
|
});
|
|
</script>
|