Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/FileAPI/blob/Blob-XHR-revoke.html

Issue 2711183003: Import wpt@a7e9c2abcf65b78fcf1c246fec6681c74e1bc352 (Closed)
Patch Set: Update test expectations and baselines. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <title>Revoking blob URL used with XMLHttpRequest</title> 2 <title>Revoking blob URL used with XMLHttpRequest</title>
3 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 5
6 <script> 6 <script>
7 async_test(function(t) { 7 async_test(function(t) {
8 var blob = new Blob(["test"]); 8 var blob = new Blob(["test"]);
9 var url = URL.createObjectURL(blob); 9 var url = URL.createObjectURL(blob);
10 var xhr = new XMLHttpRequest(); 10 var xhr = new XMLHttpRequest();
11 xhr.open("GET", url); 11 xhr.open("GET", url);
12 12
13 // Revoke the object URL. XHR should take a reference to the blob as soon a s 13 // Revoke the object URL. XHR should take a reference to the blob as soon a s
14 // it receives it in open(), so the request succeeds even though we revoke t he 14 // it receives it in open(), so the request succeeds even though we revoke t he
15 // URL before calling send(). 15 // URL before calling send().
16 URL.revokeObjectURL(url); 16 URL.revokeObjectURL(url);
17 17
18 xhr.send(); 18 xhr.send();
19 19
20 xhr.onload = t.step_func(function() { 20 xhr.onload = t.step_func_done(function() {
21 assert_equals(xhr.response, "test"); 21 assert_equals(xhr.response, "test");
22 t.done();
23 }) 22 })
24 xhr.onerror = t.step_func(function() { 23 xhr.onerror = t.step_func(function() {
25 assert_unreached("Got unexpected error event"); 24 assert_unreached("Got unexpected error event");
26 }) 25 })
27 }); 26 }, "Revoke blob URL after open(), will fetch");
28 </script> 27
28 async_test(t => {
29 const blob = new Blob(["test"]),
30 blobURL = URL.createObjectURL(blob),
31 client = new XMLHttpRequest
32 URL.revokeObjectURL(blobURL)
33 client.open("GET", blobURL)
34 client.onload = t.step_func(() => assert_unreached("Got unexpected load event" ))
35 client.onerror = t.step_func_done()
36 client.send()
37 }, "Revoke blob URL before open(), network error (after send())")
38 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698