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

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

Issue 1857723002: Fetch: opaque redirect responses have a URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: this. Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 var request = new Request(redirect_original_url, {redirect: 'manual'}); 165 var request = new Request(redirect_original_url, {redirect: 'manual'});
166 assert_equals(request.url, redirect_original_url, 166 assert_equals(request.url, redirect_original_url,
167 'Request\'s url is the original URL'); 167 'Request\'s url is the original URL');
168 assert_equals(request.redirect, 'manual'); 168 assert_equals(request.redirect, 'manual');
169 169
170 return fetch(request) 170 return fetch(request)
171 .then(function(response) { 171 .then(function(response) {
172 assert_equals(response.status, 0); 172 assert_equals(response.status, 0);
173 assert_equals(response.type, 'opaqueredirect'); 173 assert_equals(response.type, 'opaqueredirect');
174 assert_equals(response.url, ''); 174 assert_equals(response.url, request.url);
175 }); 175 });
176 }, 'Manual redirect fetch returns opaque redirect response'); 176 }, 'Manual redirect fetch returns opaque redirect response');
177 177
178 promise_test(function(t) { 178 promise_test(function(t) {
179 var redirect_target_url = 179 var redirect_target_url =
180 OTHER_ORIGIN + '/fetch/resources/fetch-status.php?status=200'; 180 OTHER_ORIGIN + '/fetch/resources/fetch-status.php?status=200';
181 var redirect_original_url = 181 var redirect_original_url =
182 OTHER_ORIGIN + '/serviceworker/resources/redirect.php?Redirect=' + 182 OTHER_ORIGIN + '/serviceworker/resources/redirect.php?Redirect=' +
183 redirect_target_url; 183 redirect_target_url;
184 184
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 assert_true(req.bodyUsed); 362 assert_true(req.bodyUsed);
363 }, 'Calling fetch() disturbs body if not null'); 363 }, 'Calling fetch() disturbs body if not null');
364 364
365 test(t => { 365 test(t => {
366 var req = new Request('/', {method: 'POST'}); 366 var req = new Request('/', {method: 'POST'});
367 fetch(req); 367 fetch(req);
368 assert_false(req.bodyUsed); 368 assert_false(req.bodyUsed);
369 }, 'Calling fetch() doesn\'t disturb body if null'); 369 }, 'Calling fetch() doesn\'t disturb body if null');
370 370
371 done(); 371 done();
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/FetchResponseData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698