OLD | NEW |
1 if (self.importScripts) { | 1 if (self.importScripts) { |
2 importScripts('../resources/fetch-test-helpers.js'); | 2 importScripts('../resources/fetch-test-helpers.js'); |
3 } | 3 } |
4 | 4 |
5 var URL = 'https://www.example.com/test.html'; | 5 var URL = 'https://www.example.com/test.html'; |
6 | 6 |
7 test(function() { | 7 test(function() { |
8 var headers = new Headers; | 8 var headers = new Headers; |
9 headers.set('User-Agent', 'Mozilla/5.0'); | 9 headers.set('User-Agent', 'Mozilla/5.0'); |
10 headers.set('Accept', 'text/html'); | 10 headers.set('Accept', 'text/html'); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 'origin', 'kept original policy'); | 498 'origin', 'kept original policy'); |
499 assert_equals(new Request(r, {mode: 44}).referrerPolicy, | 499 assert_equals(new Request(r, {mode: 44}).referrerPolicy, |
500 '', 'cleared policy'); | 500 '', 'cleared policy'); |
501 assert_equals(new Request(r, {referrerPolicy: 'unsafe-url'}).referrerPolicy, | 501 assert_equals(new Request(r, {referrerPolicy: 'unsafe-url'}).referrerPolicy, |
502 'unsafe-url', 'overriden policy'); | 502 'unsafe-url', 'overriden policy'); |
503 }, 'Referrer policy should be cleared when any members are set'); | 503 }, 'Referrer policy should be cleared when any members are set'); |
504 | 504 |
505 // Spec: https://fetch.spec.whatwg.org/#dom-request | 505 // Spec: https://fetch.spec.whatwg.org/#dom-request |
506 // Step 21: | 506 // Step 21: |
507 // If request's method is `GET` or `HEAD`, throw a TypeError. | 507 // If request's method is `GET` or `HEAD`, throw a TypeError. |
508 promise_test(function() { | 508 test(function() { |
509 var headers = new Headers; | 509 var headers = new Headers; |
510 headers.set('Content-Language', 'ja'); | 510 headers.set('Content-Language', 'ja'); |
511 ['GET', 'HEAD'].forEach(function(method) { | 511 ['GET', 'HEAD'].forEach(function(method) { |
512 assert_throws( | 512 assert_throws( |
513 {name: 'TypeError'}, | 513 {name: 'TypeError'}, |
514 function() { | 514 function() { |
515 new Request(URL, | 515 new Request(URL, |
516 {method: method, | 516 {method: method, |
517 body: new Blob(['Test Blob'], {type: 'test/type'}) | 517 body: new Blob(['Test Blob'], {type: 'test/type'}) |
518 }); | 518 }); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 credentials: 'include', | 813 credentials: 'include', |
814 body: 'this is a body'}); | 814 body: 'this is a body'}); |
815 | 815 |
816 return req.text() | 816 return req.text() |
817 .then(t => { | 817 .then(t => { |
818 assert_equals(t, 'this is a body'); | 818 assert_equals(t, 'this is a body'); |
819 }); | 819 }); |
820 }, 'Credentials and body can both be set.'); | 820 }, 'Credentials and body can both be set.'); |
821 | 821 |
822 done(); | 822 done(); |
OLD | NEW |