1 self.onmessage = function(e) {
3 if ('port' in message) {
10 port.postMessage('quit');
13 function doFetchTwiceTest(port) {
14 var p1Out = p2Out = null;
17 .then(function(response) {
18 var p1 = response.text();
19 var p2 = response.text();
21 p1.then(function(obj) {
27 p2.catch(function(e) {
36 port.postMessage(p1Out + ' : ' + p2Out.name);
41 function doArrayBufferTest(port) {
43 .then(function(response) {
44 response.arrayBuffer()
46 port.postMessage('ArrayBuffer: ' + b.byteLength);
47 doFetchTwiceTest(port);
52 function doBlobTest(port) {
54 .then(function(response) {
56 .then(function(blob) {
57 port.postMessage('Blob: ' + blob.size + " : " + blob.type);
58 doArrayBufferTest(port);
63 function doJSONFailedTest(port) {
65 .then(function(response) {
68 port.postMessage('JSON: ' + e.name);
74 function doJSONTest(port) {
76 .then(function(response) {
78 .then(function(json) {
79 port.postMessage('JSON: ' + json['a'] + ' ' + json['b']);
80 doJSONFailedTest(port);
85 function doTextTest(port) {
87 .then(function(response) {
90 port.postMessage('Text: ' + txt);