1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #2454 from yurydelendik/worker-xhr-response

Tests presence of the xhr-response in the worker
This commit is contained in:
Brendan Dahl 2013-01-04 09:12:01 -08:00
commit c05f073a73
3 changed files with 55 additions and 3 deletions

View file

@ -152,7 +152,19 @@ var WorkerMessageHandler = {
}
handler.on('test', function wphSetupTest(data) {
handler.send('test', data instanceof Uint8Array);
// check if Uint8Array can be sent to worker
if (!(data instanceof Uint8Array)) {
handler.send('test', false);
return;
}
// check if the response property is supported by xhr
var xhr = new XMLHttpRequest();
if (!('response' in xhr || 'mozResponse' in xhr ||
'responseArrayBuffer' in xhr || 'mozResponseArrayBuffer' in xhr)) {
handler.send('test', false);
return;
}
handler.send('test', true);
});
handler.on('GetDocRequest', function wphSetupDoc(data) {