Tests presence of the xhr-response in the worker

This commit is contained in:
Yury Delendik 2012-12-11 11:07:58 -06:00
parent 9583cb7108
commit 0e70aacc51
3 changed files with 55 additions and 3 deletions

View file

@ -17,7 +17,16 @@
onmessage = function (e) {
var data = e.data;
postMessage({action: 'test', result: data.action == 'test' &&
data.data instanceof Uint8Array});
switch (data.action) {
case 'test':
postMessage({action: 'test', result: data.data instanceof Uint8Array});
break;
case 'xhr':
var xhr = new XMLHttpRequest();
var responseExists = 'response' in xhr || 'mozResponse' in xhr ||
'responseArrayBuffer' in xhr || 'mozResponseArrayBuffer' in xhr;
postMessage({action: 'xhr', result: responseExists});
break;
}
};