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

Merge upstream.

This commit is contained in:
Brendan Dahl 2012-04-05 12:46:23 -07:00
commit fece736b8a
30 changed files with 2330 additions and 1891 deletions

View file

@ -248,16 +248,21 @@ function done() {
}
}
function sendTaskResult(snapshot, task, failure) {
var result = { browser: browser,
id: task.id,
numPages: task.pdfDoc ?
(task.pageLimit || task.pdfDoc.numPages) : 0,
failure: failure,
file: task.file,
round: task.round,
page: task.pageNum,
snapshot: snapshot };
function sendTaskResult(snapshot, task, failure, result) {
// Optional result argument is for retrying XHR requests - see below
if (!result) {
result = JSON.stringify({
browser: browser,
id: task.id,
numPages: task.pdfDoc ?
(task.pageLimit || task.pdfDoc.numPages) : 0,
failure: failure,
file: task.file,
round: task.round,
page: task.pageNum,
snapshot: snapshot
});
}
var r = new XMLHttpRequest();
// (The POST URI is ignored atm.)
@ -266,10 +271,13 @@ function sendTaskResult(snapshot, task, failure) {
r.onreadystatechange = function sendTaskResultOnreadystatechange(e) {
if (r.readyState == 4) {
inFlightRequests--;
// Retry until successful
if (r.status !== 200)
sendTaskResult(null, null, null, result);
}
};
document.getElementById('inFlightCount').innerHTML = inFlightRequests++;
r.send(JSON.stringify(result));
r.send(result);
}
function clear(ctx) {

View file

@ -1 +1 @@
http://www.cdc.gov/ncidod/dvbid/westnile/languages/chinese.pdf
http://web.archive.org/web/20110623114753/http://www.cdc.gov/ncidod/dvbid/westnile/languages/chinese.pdf