When a link element's href changes, the spec expects the callback to check if "el contributes a script-blocking style sheet" (step 6). This check examines current fetch state, which fails when old fetch callbacks run after a new fetch has started. Use FetchController::stop_fetch() instead of abort() to prevent old fetch callbacks from executing entirely. This ensures only the current fetch's callback runs, allowing it to correctly check current state per spec without race conditions.
19 lines
No EOL
462 B
HTML
19 lines
No EOL
462 B
HTML
<!doctype html>
|
|
<link id="l" rel="stylesheet" href="a.css">
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest(done => {
|
|
const l = document.getElementById('l');
|
|
|
|
println('Starting rapid href changes...');
|
|
|
|
l.removeAttribute('href');
|
|
l.setAttribute('href', ' page.html ');
|
|
l.setAttribute('href', 'ht!tp://example.com');
|
|
|
|
setTimeout(() => {
|
|
println('Test completed without crash');
|
|
done();
|
|
}, 100);
|
|
});
|
|
</script> |