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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/sendbeacon/beacon-cross-origin-redirect-blob.html

Issue 2870383002: Have sendBeacon throw for Blobs with a type that is not CORS-safelisted. (Closed)
Patch Set: Rebase Created 3 years, 7 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 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script> 2 <script src="/js-test-resources/js-test.js"></script>
5 <script> 3 <script>
6 description("Verifying navigator.sendBeacon(Blob) non-CORS cross-origin redirect handling."); 4 description("Verifying navigator.sendBeacon(Blob) non-CORS cross-origin redirect handling.");
7 5
8 window.jsTestIsAsync = true; 6 if (window.testRunner) {
7 testRunner.dumpPingLoaderCallbacks();
8 }
9 9
10 var blob; 10 const blob = new Blob(["Cross", "Origin"], {type: "text/plain;from-beacon=true"} );
11 function test() { 11 // The "simple" parameter is just for differentiating the URLs.
12 if (window.testRunner) { 12 shouldBeTrue('navigator.sendBeacon("http://127.0.0.1:8080/resources/redirection- response.php?status=302&simple=true&target=/non-existent.php", blob);');
13 testRunner.dumpAsText();
14 testRunner.dumpPingLoaderCallbacks();
15 }
16
17 blob = new Blob(["Cross", "Origin"], {type: "text/plain;from-beacon=true"});
18 // The "simple" parameter is just for differentiating the URLs.
19 shouldBeTrue('navigator.sendBeacon("http://127.0.0.1:8080/resources/redirect ion-response.php?status=302&simple=true&target=/non-existent.php", blob);');
20 // Wait a while for the redirect response handling to happen before finishin g up.
21 setTimeout(function () {
22 blob = new Blob([new Uint8Array(20)], {type: "application/octet-stream"} );
23 shouldBeTrue('navigator.sendBeacon("http://127.0.0.1:8080/resources/redi rection-response.php?status=302&simple=false&target=/non-existent.php", blob);') ;
24 setTimeout(finishJSTest, 200);
25 }, 200);
26 }
27 </script> 13 </script>
28 </head>
29 <body onload="test();">
30 </body>
31 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698