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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/fetch.js

Issue 2783623003: Fetch API: Don't exclude the URL fragment in Request#url (Closed)
Patch Set: Created 3 years, 8 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 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 promise_test(function(t) { 5 promise_test(function(t) {
6 return fetch('http://') 6 return fetch('http://')
7 .then( 7 .then(
8 t.unreached_func('fetch of invalid URL must fail'), 8 t.unreached_func('fetch of invalid URL must fail'),
9 function() {}); 9 function() {});
10 }, 'Fetch invalid URL'); 10 }, 'Fetch invalid URL');
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 self.internals.getInternalResponseURLList(response), 160 self.internals.getInternalResponseURLList(response),
161 [request.url]); 161 [request.url]);
162 } 162 }
163 }); 163 });
164 }, 'Fetch result of 404 response'); 164 }, 'Fetch result of 404 response');
165 165
166 promise_test(function(t) { 166 promise_test(function(t) {
167 var request = new Request( 167 var request = new Request(
168 '/fetch/resources/fetch-status.php?status=200#fragment'); 168 '/fetch/resources/fetch-status.php?status=200#fragment');
169 169
170 // The url attribute's getter must return request's url, 170 // The url attribute's getter must return request's url with the fragment
171 // serialized with the exclude fragment flag set. 171 // flag set.
falken 2017/03/31 06:40:49 There's no "fragment flag", it's just the "exclude
yiyix 2017/03/31 07:24:02 True, the term "flag set" is not used in the spec.
172 assert_equals(request.url, 172 assert_equals(request.url,
173 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200'); 173 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200#fragment');
174 174
175 return fetch(request) 175 return fetch(request)
176 .then(function(response) { 176 .then(function(response) {
177 assert_equals(response.status, 200); 177 assert_equals(response.status, 200);
178 assert_equals(response.statusText, 'OK'); 178 assert_equals(response.statusText, 'OK');
179 // The url attribute's getter must return the empty string 179 // The url attribute's getter must return the empty string
180 // if response's url is null and response's url, 180 // if response's url is null and response's url,
181 // serialized with the exclude fragment flag set, otherwise. 181 // serialized with the exclude fragment flag set, otherwise.
182 assert_equals(response.url, 182 assert_equals(response.url,
183 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200'); 183 BASE_ORIGIN + '/fetch/resources/fetch-status.php?status=200');
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 assert_true(req.bodyUsed); 443 assert_true(req.bodyUsed);
444 }, 'Calling fetch() disturbs body if not null'); 444 }, 'Calling fetch() disturbs body if not null');
445 445
446 test(t => { 446 test(t => {
447 var req = new Request('/', {method: 'POST'}); 447 var req = new Request('/', {method: 'POST'});
448 fetch(req); 448 fetch(req);
449 assert_false(req.bodyUsed); 449 assert_false(req.bodyUsed);
450 }, 'Calling fetch() doesn\'t disturb body if null'); 450 }, 'Calling fetch() doesn\'t disturb body if null');
451 451
452 done(); 452 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698