Skip to content

Commit 17c1018

Browse files
author
Tim de Koning
committed
lint compliance
1 parent 823db83 commit 17c1018

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

src/api.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
* @return {Promise} A promise that is resolved with {PDFDocumentProxy} object.
1919
*/
2020
PDFJS.getDocument = function getDocument(source) {
21-
var url, data, headers, password, parameters = {}, workerInitializedPromise, workerReadyPromise, transport;
21+
var url, data, headers, password, parameters = {}, workerInitializedPromise,
22+
workerReadyPromise, transport;
23+
2224
if (typeof source === 'string') {
2325
url = source;
2426
} else if (isArrayBuffer(source)) {
@@ -49,23 +51,27 @@ PDFJS.getDocument = function getDocument(source) {
4951
{
5052
url: url,
5153
progress: function getPDFProgress(evt) {
52-
if (evt.lengthComputable)
53-
workerReadyPromise.progress({
54+
if (evt.lengthComputable) {
55+
workerReadyPromise.progress({
5456
loaded: evt.loaded,
5557
total: evt.total
5658
});
59+
}
5760
},
5861
error: function getPDFError(e) {
59-
workerReadyPromise.reject('Unexpected server response of ' +
62+
workerReadyPromise.reject('Unexpected server response of ' +
6063
e.target.status + '.');
6164
},
6265
headers: headers
6366
},
6467
function getPDFLoad(data) {
65-
//we have to wait for the WorkerTransport to finalize worker-support detection! This may take a while...
66-
workerInitializedPromise.then(function () {
67-
transport.sendData(data, parameters);
68-
});
68+
// sometimes the pdf has finished downloading before the web worker-test
69+
// has finished. In that case the rendering of the final pdf would cause
70+
// errors. We have to wait for the WorkerTransport to finalize worker-
71+
// support detection
72+
workerInitializedPromise.then(function workerInitialized() {
73+
transport.sendData(data, parameters);
74+
});
6975
});
7076
}
7177

@@ -479,7 +485,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
479485
// Thus, we fallback to a faked worker.
480486
globalScope.PDFJS.disableWorker = true;
481487
this.setupFakeWorker();
482-
workerInitializedPromise.resolve();
488+
workerInitializedPromise.resolve();
483489
}
484490
WorkerTransport.prototype = {
485491
destroy: function WorkerTransport_destroy() {

src/worker.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ function MessageHandler(name, comObj) {
2020
warn(data);
2121
}];
2222

23-
comObj.onerror = function(event){
24-
throw new Error(event.message + " (" + event.filename + ":" + event.lineno + ")");
25-
};
26-
2723
comObj.onmessage = function messageHandlerComObjOnMessage(event) {
2824
var data = event.data;
2925
if (data.isReply) {

web/compatibility.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Checking if the typed arrays are supported
77
(function checkTypedArrayCompatibility() {
88
if (typeof Uint8Array !== 'undefined') {
9-
// some mobile versions do not support subarray (e.g. safari 5 / iPhone / iPad)
9+
// some mobile versions do not support subarray (e.g. safari 5 / iOS)
1010
if (typeof Uint8Array.prototype.subarray === 'undefined') {
1111
Uint8Array.prototype.subarray = function subarray(start, end) {
1212
return new Uint8Array(this.slice(start, end));
@@ -79,9 +79,10 @@
7979

8080
// Object.defineProperty() ?
8181
(function checkObjectDefinePropertyCompatibility() {
82-
// safari 5 cannot use this on DOM objects and thus is unusable, see http://kangax.github.com/es5-compat-table/
83-
if ((typeof Object.defineProperty !== 'undefined') && /Safari\/5/.test(navigator.userAgent))
84-
return;
82+
// safari 5 cannot use this on DOM objects and thus is unusable,
83+
// see http://kangax.github.com/es5-compat-table/
84+
if ((typeof Object.defineProperty !== 'undefined') &&
85+
/Safari\/5/.test(navigator.userAgent)) return;
8586

8687
Object.defineProperty = function objectDefineProperty(obj, name, def) {
8788
delete obj[name];

0 commit comments

Comments
 (0)