1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

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

@ -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) {