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

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: incorporated yhirano and jsbell's comment 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..cf253f84988eccfa9dfd720c512e67ba6f41f674 100644
--- a/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js
+++ b/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-worker.js
@@ -75,15 +75,23 @@ self.addEventListener('fetch', function(event) {
} else if (!params['noChange']) {
request = new Request(request, init);
}
+ var response;
fetch(request)
.then(function(res) {
- // Send the result to fetch-access-control.html.
- port.postMessage({fetchResult: 'resolved',
- hasBody: !!res.body,
- headers: headersToArray(res.headers),
- type: res.type,
- originalURL: originalURL});
- resolve(res);
+ response = res;
+ res.text()
yhirano 2014/09/10 11:11:29 How about flattening then by doing something like
horo 2014/09/11 03:07:14 If do so, {fetchResult: 'rejected'} will be sent w
+ .then(function(body) {
+ // Send the result to fetch-access-control.html.
+ port.postMessage(
+ {
+ fetchResult: 'resolved',
+ body: body,
+ headers: headersToArray(response.headers),
+ type: response.type,
+ originalURL: originalURL
+ });
+ resolve(response);
+ });
})
.catch(function(e) {
// Send the result to fetch-access-control.html.

Powered by Google App Engine
This is Rietveld 408576698