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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.js

Issue 1311933003: Deflake http/tests/serviceworker/request-end-to-end.html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: text expectations Created 5 years, 4 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
« no previous file with comments | « LayoutTests/http/tests/serviceworker/request-end-to-end.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.js b/LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.js
index 6e2a8bfb14df6d2cf01db44e993c61a8e35852e3..f58036c2cd29433168b10fcbb98f0a4cc79a07f4 100644
--- a/LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.js
+++ b/LayoutTests/http/tests/serviceworker/resources/request-end-to-end-worker.js
@@ -1,30 +1,21 @@
-var port = undefined;
-
-onmessage = function(e) {
- var message = e.data;
- if (typeof message === 'object' && 'port' in message) {
- port = message.port;
- }
-};
-
onfetch = function(e) {
var headers = {};
for (var header of e.request.headers) {
var key = header[0], value = header[1];
headers[key] = value;
}
- var errorNameWhileAddingHeader = '';
+ var append_header_error = '';
try {
e.request.headers.append('Test-Header', 'TestValue');
- } catch (e) {
- errorNameWhileAppendingHeader = e.name;
+ } catch (error) {
+ append_header_error = error.name;
}
- port.postMessage({
- url: e.request.url,
- method: e.request.method,
- referrer: e.request.referrer,
- headers: headers,
- headerSize: e.request.headers.size,
- errorNameWhileAppendingHeader: errorNameWhileAppendingHeader
- });
+
+ e.respondWith(new Response(JSON.stringify({
+ url: e.request.url,
+ method: e.request.method,
+ referrer: e.request.referrer,
+ headers: headers,
+ append_header_error: append_header_error
+ })));
};
« no previous file with comments | « LayoutTests/http/tests/serviceworker/request-end-to-end.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698