blob: 5839273be9aa5315fd8e3fb3549e2167be20615b [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("Tests the lifetime of a Blob URL with a fragment.");
jsTestIsAsync = true;
onload = () => {
let blobContents = `<body>FOO</body>`;
let blob = new Blob([blobContents], { type: "text/html" });
blobURL = URL.createObjectURL(blob);
blobURLWithFragment = blobURL + "#foo=1";
iframe = document.getElementById("testFrame");
iframe.onload = () => {
shouldBeEqualToString("iframe.contentDocument.body.innerText", "FOO");
shouldBeTrue("iframe.contentWindow.location.href == blobURLWithFragment");
shouldBeTrue("iframe.contentDocument.URL == blobURLWithFragment");
finishJSTest();
};
let anchor = document.createElement("a");
anchor.target = "testFrame";
anchor.href = blobURLWithFragment;
anchor.click();
URL.revokeObjectURL(blobURL);
}
</script>
<iframe id="testFrame" name="testFrame" src="about:blank"></iframe>
</body>
</html>