| Index: LayoutTests/http/tests/serviceworker/resources/fetch-body-mixin-worker.js
|
| diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-body-mixin-worker.js b/LayoutTests/http/tests/serviceworker/resources/fetch-body-mixin-worker.js
|
| index f53811da0ed62fc2a05f2722232e3175918ef3ac..4d645e75521ee495f29ac2da472c0037d180bd95 100644
|
| --- a/LayoutTests/http/tests/serviceworker/resources/fetch-body-mixin-worker.js
|
| +++ b/LayoutTests/http/tests/serviceworker/resources/fetch-body-mixin-worker.js
|
| @@ -1,94 +1,94 @@
|
| self.onmessage = function(e) {
|
| - var message = e.data;
|
| - if ('port' in message) {
|
| - port = message.port;
|
| - doTextTest(port);
|
| - }
|
| + var message = e.data;
|
| + if ('port' in message) {
|
| + port = message.port;
|
| + doTextTest(port);
|
| + }
|
| };
|
|
|
| function quit(port) {
|
| - port.postMessage('quit');
|
| + port.postMessage('quit');
|
| }
|
|
|
| function doFetchTwiceTest(port) {
|
| var p1Out = p2Out = null;
|
|
|
| fetch('doctype.html')
|
| - .then(function(response) {
|
| - var p1 = response.text();
|
| - var p2 = response.text();
|
| + .then(function(response) {
|
| + var p1 = response.text();
|
| + var p2 = response.text();
|
|
|
| - p1.then(function(obj) {
|
| - p1Out = obj;
|
| - if (p2Out) {
|
| + p1.then(function(obj) {
|
| + p1Out = obj;
|
| + if (p2Out) {
|
| complete();
|
| - }
|
| - });
|
| - p2.catch(function(e) {
|
| - p2Out = e;
|
| - if (p1Out) {
|
| + }
|
| + });
|
| + p2.catch(function(e) {
|
| + p2Out = e;
|
| + if (p1Out) {
|
| complete();
|
| - }
|
| + }
|
| + });
|
| });
|
| - });
|
|
|
| function complete() {
|
| - port.postMessage(p1Out + ' : ' + p2Out.name);
|
| - quit(port);
|
| + port.postMessage(p1Out + ' : ' + p2Out.name);
|
| + quit(port);
|
| }
|
| }
|
|
|
| function doArrayBufferTest(port) {
|
| - fetch('doctype.html')
|
| + fetch('doctype.html')
|
| .then(function(response) {
|
| response.arrayBuffer()
|
| - .then(function(b) {
|
| - port.postMessage('ArrayBuffer: ' + b.byteLength);
|
| - doFetchTwiceTest(port);
|
| - });
|
| - });
|
| + .then(function(b) {
|
| + port.postMessage('ArrayBuffer: ' + b.byteLength);
|
| + doFetchTwiceTest(port);
|
| + });
|
| + });
|
| }
|
|
|
| function doBlobTest(port) {
|
| - fetch('doctype.html')
|
| + fetch('doctype.html')
|
| .then(function(response) {
|
| response.blob()
|
| - .then(function(blob) {
|
| - port.postMessage('Blob: ' + blob.size + " : " + blob.type);
|
| - doArrayBufferTest(port);
|
| - });
|
| - });
|
| + .then(function(blob) {
|
| + port.postMessage('Blob: ' + blob.size + ' : ' + blob.type);
|
| + doArrayBufferTest(port);
|
| + });
|
| + });
|
| }
|
|
|
| function doJSONFailedTest(port) {
|
| fetch('doctype.html')
|
| - .then(function(response) {
|
| - response.json()
|
| - .catch(function(e) {
|
| - port.postMessage('JSON: ' + e.name);
|
| - doBlobTest(port);
|
| + .then(function(response) {
|
| + response.json()
|
| + .catch(function(e) {
|
| + port.postMessage('JSON: ' + e.name);
|
| + doBlobTest(port);
|
| + });
|
| });
|
| - });
|
| }
|
|
|
| function doJSONTest(port) {
|
| - fetch('simple.json')
|
| + fetch('simple.json')
|
| .then(function(response) {
|
| response.json()
|
| - .then(function(json) {
|
| - port.postMessage('JSON: ' + json['a'] + ' ' + json['b']);
|
| - doJSONFailedTest(port);
|
| - });
|
| - });
|
| + .then(function(json) {
|
| + port.postMessage('JSON: ' + json['a'] + ' ' + json['b']);
|
| + doJSONFailedTest(port);
|
| + });
|
| + });
|
| }
|
|
|
| function doTextTest(port) {
|
| fetch('doctype.html')
|
| - .then(function(response) {
|
| - response.text()
|
| - .then(function(txt) {
|
| - port.postMessage('Text: ' + txt);
|
| - doJSONTest(port);
|
| + .then(function(response) {
|
| + response.text()
|
| + .then(function(txt) {
|
| + port.postMessage('Text: ' + txt);
|
| + doJSONTest(port);
|
| + });
|
| });
|
| - });
|
| }
|
|
|