Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / security / anchor-download-allow-blob.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 <script type='text/javascript'>
6 if (window.testRunner) {
7   // The test will end when loadURLExternally() is invoked.
8   testRunner.waitUntilExternalURLLoad();
9 }
10 </script>
11 </head>
12 <body>
13 <p>
14 Tests that a suggested filename on a download attribute is allowed if
15 <a id="dl" download="foo.pdf">the link</a> is a blob URL.
16 <p>
17 The suggested filename at the top should be foo.pdf.
18 <script>
19 function click(elmt)
20 {
21     if (!window.eventSender) {
22         return;
23     }
24     eventSender.mouseMoveTo(elmt.offsetLeft + 5, elmt.offsetTop + 5);
25     eventSender.mouseDown();
26     eventSender.mouseUp();
27 }
28
29 function runTest()
30 {
31     var blob = new Blob(["Hello world!"], {type: "application/octet-stream"});
32     var link = document.getElementById("dl");
33     link.href = window.URL.createObjectURL(blob);
34     click(link);
35 }
36 runTest();
37 </script>
38 </body>
39 </html>