OLD | NEW |
(Empty) | |
| 1 if (this.document === undefined) { |
| 2 importScripts("/common/get-host-info.sub.js") |
| 3 importScripts("/resources/testharness.js"); |
| 4 } |
| 5 |
| 6 var dataURL = "data:text/plain;base64,cmVzcG9uc2UncyBib2R5"; |
| 7 var body = "response's body"; |
| 8 var contentType = "text/plain"; |
| 9 |
| 10 function redirectDataURL(desc, redirectUrl, mode) { |
| 11 var url = redirectUrl + "?cors&location=" + encodeURIComponent(dataURL); |
| 12 |
| 13 var requestInit = {"mode": mode}; |
| 14 |
| 15 promise_test(function(test) { |
| 16 return promise_rejects(test, new TypeError(), fetch(url, requestInit)); |
| 17 }, desc); |
| 18 } |
| 19 |
| 20 var redirUrl = get_host_info().HTTP_ORIGIN + "/fetch/api/resources/redirect.py"; |
| 21 var corsRedirUrl = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/api/resources/re
direct.py"; |
| 22 |
| 23 redirectDataURL("Testing data URL loading after same-origin redirection (cors mo
de)", redirUrl, "cors"); |
| 24 redirectDataURL("Testing data URL loading after same-origin redirection (no-cors
mode)", redirUrl, "no-cors"); |
| 25 redirectDataURL("Testing data URL loading after same-origin redirection (same-or
igin mode)", redirUrl, "same-origin"); |
| 26 |
| 27 redirectDataURL("Testing data URL loading after cross-origin redirection (cors m
ode)", corsRedirUrl, "cors"); |
| 28 redirectDataURL("Testing data URL loading after cross-origin redirection (no-cor
s mode)", corsRedirUrl, "no-cors"); |
| 29 |
| 30 done(); |
OLD | NEW |