Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Use navigation for <a download>" #10245

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,22 @@
<link rel="help" href="https://github.com/whatwg/html/issues/2116">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>

<img src="/images/threecolors.png" usemap="#x" id="img" width="300" height="300">
<map name="x">
<area id="blob-url" download="foo.html" coords="0,0,300,300">
</map>

<script>
"use strict";
async_test(t => {
const frame = document.createElement("iframe");

frame.addEventListener("load", t.step_func(function () {
frame.contentWindow.addEventListener(
"beforeunload", t.unreached_func("Navigated instead of downloading"));
const string = "test";
const blob = new Blob([string], { type: "text/html" });
const string = "test";
const blob = new Blob([string], { type: "text/html" });

const link = frame.contentDocument.querySelector("#blob-url");
link.href = URL.createObjectURL(blob);
const link = document.querySelector("#blob-url");
link.href = URL.createObjectURL(blob);

link.click();
link.click();

t.step_timeout(() => t.done(), 1000);
}));
frame.src = "resources/area-download-click.html";
document.body.appendChild(frame);
}, "Clicking on an <area> element with a download attribute must not throw an exception");
done();
</script>
</body>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
async_test(t => {
const errorFrame = document.createElement("iframe");

errorFrame.addEventListener("load", t.step_func(function () {
errorFrame.addEventListener("load", function () {
errorFrame.contentWindow.addEventListener(
"beforeunload", t.unreached_func("Navigated instead of downloading"));

errorFrame.contentDocument.querySelector("#error-url").click();
t.step_timeout(() => t.done(), 1000);
}));
});
errorFrame.src = "resources/a-download-404.html";
document.body.appendChild(errorFrame);
}, "Do not navigate to 404 for anchor with download");
</script>
</body>
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,18 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<body>
<a id="blob-url" download="foo.html">Click me</a>

<script>
"use strict";
async_test(t => {
const frame = document.createElement("iframe");

frame.addEventListener("load", t.step_func(function () {
frame.contentWindow.addEventListener(
"beforeunload", t.unreached_func("Navigated instead of downloading"));
const string = "test";
const blob = new Blob([string], { type: "text/html" });
const string = "test";
const blob = new Blob([string], { type: "text/html" });

const link = frame.contentDocument.querySelector("#blob-url");
link.href = URL.createObjectURL(blob);
const link = document.querySelector("#blob-url");
link.href = URL.createObjectURL(blob);

link.click();
link.click();

t.step_timeout(() => t.done(), 1000);
}));
frame.src = "resources/a-download-click.html";
document.body.appendChild(frame);
}, "Clicking on an <a> element with a download attribute must not throw an exception");
done();
</script>
</body>

This file was deleted.