mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 10:20:22 +00:00
Atlassian login gets the base URL for its module scripts by throwing an error and pulling out the current script's URL from error.stack with regex. Since we only returned a basename for module scripts, it would fail to match and try and use `/` as a base URL (because it does [matched_string] + "/"), which is not a valid base URL.
43 lines
1.4 KiB
HTML
43 lines
1.4 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;
|
|
globalThis.println("${type}: " + e.stack.replace(uuidRegex, "[flaky-uuid-replaced]"));
|
|
}
|
|
`;
|
|
|
|
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>
|