mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
When files have an opaque origin, the "file" scheme is omitted from the blob URL serialization in the stack trace. This change normalizes the output in the test so that both tuple file origins and opaque file origins (which may serialize as 'blob:ladybird/') is accepted, ensuring the test passes in both scenarios.
47 lines
1.6 KiB
HTML
47 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<script src="include.js"></script>
|
|
<div id="script-container"></div>
|
|
<script>
|
|
asyncTest(async (done) => {
|
|
const scriptContainer = document.getElementById("script-container");
|
|
|
|
const createScript = (type) => {
|
|
return new Promise((resolve) => {
|
|
const scriptSource = `
|
|
try {
|
|
throw Error();
|
|
} catch (e) {
|
|
const uuidRegex = /[a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+/g;
|
|
const normalizedStack = e.stack
|
|
.replace(uuidRegex, "[flaky-uuid-replaced]")
|
|
.replace(/blob:(file:\\/\\/\\/|ladybird\\/)/g, "blob:<origin>/");
|
|
globalThis.println("${type}: " + normalizedStack);
|
|
}
|
|
`;
|
|
|
|
const scriptBlob = new Blob([scriptSource], { type: "text/javascript" });
|
|
const scriptBlobUrl = URL.createObjectURL(scriptBlob);
|
|
|
|
const script = document.createElement("script");
|
|
script.onload = () => {
|
|
resolve();
|
|
};
|
|
script.src = scriptBlobUrl;
|
|
|
|
if (type !== "classic")
|
|
script.type = type;
|
|
|
|
scriptContainer.appendChild(script);
|
|
});
|
|
};
|
|
|
|
const scriptPromises = [
|
|
createScript("classic"),
|
|
createScript("module"),
|
|
];
|
|
|
|
await Promise.all(scriptPromises);
|
|
done();
|
|
});
|
|
</script>
|