summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/download_page.html
blob: 625ff46aab1c76e33c8cf151e15de41be4043bba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=676619
-->
  <head>
    <title>Test for the download attribute</title>

  </head>
  <body>
    <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=676619">Bug 676619</a>
    <br/>
    <ul>
        <li><a href="download_page_1.txt"
                download="test.txt" id="link1">Download "test.txt"</a></li>
        <li><a href="video.webm"
                download id="link2">Download "video.webm"</a></li>
        <li><a href="video.webm"
                download="just some video.webm" id="link3">Download "just some video.webm"</a></li>
        <li><a href="download_page_2.txt"
                download="with-target.txt" id="link4">Download "with-target.txt"</a></li>
        <li><a href="javascript:(1+2)+''"
            download="javascript.html" id="link5">Download "javascript.html"</a></li>
        <li><a href="#" download="test.blob" id=link6>Download "test.blob"</a></li>
        <li><a href="#" download="test.file" id=link7>Download "test.file"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?inline=download_page_3.txt"
            download="not_used.txt" id="link8">Download "download_page_3.txt"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?attachment=download_page_3.txt"
            download="not_used.txt" id="link9">Download "download_page_3.txt"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?inline=none"
            download="download_page_4.txt" id="link10">Download "download_page_4.txt"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?attachment=none"
            download="download_page_4.txt" id="link11">Download "download_page_4.txt"</a></li>
        <li><a href="http://example.com/"
            download="example.com" id="link12" target="_blank">Download "example.com"</a></li>
        <li><a href="video.webm"
            download="no file extension" id="link13">Download "force extension"</a></li>
        <li><a href="dummy.ics"
            download="dummy.not-ics" id="link14">Download "dummy.not-ics"</a></li>
        <li><a href="redirect_download.sjs?inline=download_page_3.txt"
            download="not_used.txt" id="link15">Download "download_page_3.txt"</a></li>
        <li><a href="redirect_download.sjs?attachment=download_page_3.txt"
            download="not_used.txt" id="link16">Download "download_page_3.txt"</a></li>
        <li><a href="redirect_download.sjs?inline=none"
            download="download_page_4.txt" id="link17">Download "download_page_4.txt"</a></li>
        <li><a href="redirect_download.sjs?attachment=none"
            download="download_page_4.txt" id="link18">Download "download_page_4.txt"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?inline;attachment=none"
            download="download_page_4.txt" id="link19">Download "download_page_4.txt"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?invalid=none"
            download="download_page_4.txt" id="link20">Download "download_page_4.txt"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?inline;attachment=download_page_4.txt"
            download="download_page_4.txt" id="link21">Download "download_page_4.txt"</a></li>
        <li><a href="download_with_content_disposition_header.sjs?invalid=download_page_4.txt"
            download="download_page_4.txt" id="link22">Download "download_page_4.txt"</a></li>
    </ul>
    <div id="unload-flag">Okay</div>

    <script>
        let blobURL = window.URL.createObjectURL(new Blob(["just text"], {type: "application/x-blob"}));
        document.getElementById("link6").href = blobURL;

        let fileURL = window.URL.createObjectURL(new File(["just text"],
              "wrong-file-name", {type: "application/x-some-file"}));
        document.getElementById("link7").href = fileURL;

        window.addEventListener("beforeunload", function() {
            document.getElementById("unload-flag").textContent = "Fail";
        });
    </script>
  </body>
</html>