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:
commit
c05f073a73
3 changed files with 55 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue