]> git.parisson.com Git - pdf.js.git/commitdiff
code style fixes
authorbeat <beat.wolf@hefr.ch>
Tue, 8 May 2012 12:17:51 +0000 (14:17 +0200)
committerbeat <beat.wolf@hefr.ch>
Tue, 8 May 2012 12:17:51 +0000 (14:17 +0200)
src/api.js
src/core.js

index 0c48658414965b1f3f46ba09fa2891b948d50247..1efb22caa04504e3085c924c8d80e189354460b9 100644 (file)
@@ -10,7 +10,7 @@
  * @param {string|TypedAray} source Either a url to a PDF is located or a
  * typed array (Uint8Array) already populated with data.
  * @param {Object} headers An object containing the http headers like this:
- * { Authorization: "BASIC XXX" }
+ * { Authorization: "BASIC XXX" }.
  * @return {Promise} A promise that is resolved with {PDFDocumentProxy} object.
  */
 PDFJS.getDocument = function getDocument(source, headers) {
@@ -32,7 +32,7 @@ PDFJS.getDocument = function getDocument(source, headers) {
           promise.reject('Unexpected server response of ' +
             e.target.status + '.');
         },
-       headers: headers
+        headers: headers
       },
       function getPDFLoad(data) {
         transport.sendData(data);
index e999550ca8185f761a3e69f8a51dc03de695ea6e..c6d8b743c792e3f8de7e91b193b6d80410438ee6 100644 (file)
@@ -33,13 +33,17 @@ function getPdf(arg, callback) {
   var xhr = new XMLHttpRequest();
   
   xhr.open('GET', params.url);
-  if(params.headers){
-    for(var property in params.headers){
-      if(typeof(params.headers[property]) !== undefined){
-       xhr.setRequestHeader(property, params.headers[property]);
-      }
+  
+  var headers = params.headers;
+  if (headers) {
+    for (var property in headers) {
+      if (typeof headers[property] === 'undefined')
+        continue;
+      
+      xhr.setRequestHeader(property, params.headers[property]);
     }
   }
+  
   xhr.mozResponseType = xhr.responseType = 'arraybuffer';
   var protocol = params.url.indexOf(':') < 0 ? window.location.protocol :
     params.url.substring(0, params.url.indexOf(':') + 1);