Tests: Fix flaky load-event-delayed-by-*-background-image tests

These tests set up a delayed echo endpoint using a synchronous XHR to
http://127.0.0.1:PORT/echo, but the page itself is served from
http://localhost:PORT. This cross-origin request triggers a CORS
preflight, which intermittently fails with a NetworkError. There's
already a FIXME in place to get rid of the spin_until() that caused this
to happen.

Use a relative URL instead, since the page is already served from the
echo server.

Fixes #8564
This commit is contained in:
Jelle Raaijmakers 2026-03-22 11:04:15 +01:00 committed by Shannon Booth
parent b50c53106a
commit 94bc00248f
2 changed files with 2 additions and 6 deletions

View file

@ -1,10 +1,8 @@
<!DOCTYPE html>
<script src="include.js"></script>
<script>
var echoPort = internals.getEchoServerPort();
var baseURL = `http://127.0.0.1:${echoPort}`;
var xhr = new XMLHttpRequest();
xhr.open("POST", `${baseURL}/echo`, false);
xhr.open("POST", "/echo", false);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify({
method: "GET",

View file

@ -1,10 +1,8 @@
<!DOCTYPE html>
<script src="include.js"></script>
<script>
var echoPort = internals.getEchoServerPort();
var baseURL = `http://127.0.0.1:${echoPort}`;
var xhr = new XMLHttpRequest();
xhr.open("POST", `${baseURL}/echo`, false);
xhr.open("POST", "/echo", false);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify({
method: "GET",