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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js

Issue 555443002: [Fetch API] Put body members directly on Response/Request (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js b/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js
index 1cfb4c4274d203f86816ff966d233c687d5fc964..ad0dd92bc4408bbab927612d6f1854d7a8f74c94 100644
--- a/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js
+++ b/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js
@@ -75,21 +75,25 @@ self.addEventListener('fetch', function(event) {
} else if (!params['noChange']) {
request = new Request(request, init);
}
+ var response;
fetch(request)
.then(function(res) {
+ response = res;
+ return res.text();
+ }, function(e) {
+ // Send the result to fetch-access-control.html.
yhirano 2014/09/09 09:31:48 This handler "catch"es an error, i.e. port.postMes
horo 2014/09/10 06:18:44 I was wrong. Fixed.
+ port.postMessage({fetchResult: 'rejected'});
+ reject();
+ })
+ .then(function(body) {
// Send the result to fetch-access-control.html.
port.postMessage({fetchResult: 'resolved',
- hasBody: !!res.body,
- headers: headersToArray(res.headers),
- type: res.type,
+ body: body,
+ headers: headersToArray(response.headers),
+ type: response.type,
originalURL: originalURL});
- resolve(res);
+ resolve(response);
})
- .catch(function(e) {
- // Send the result to fetch-access-control.html.
- port.postMessage({fetchResult: 'rejected'});
- reject();
- });
} catch (e) {
// Send the result to fetch-access-control.html.
port.postMessage({fetchResult: 'error'});

Powered by Google App Engine
This is Rietveld 408576698