]> git.parisson.com Git - pdf.js.git/commitdiff
Fixing test execution / relative URL protocol detection
authornotmasteryet <async.processingjs@yahoo.com>
Fri, 3 Feb 2012 05:31:12 +0000 (23:31 -0600)
committernotmasteryet <async.processingjs@yahoo.com>
Fri, 3 Feb 2012 05:31:12 +0000 (23:31 -0600)
src/core.js

index a34954ab170b72ce997e642349b21b3e19abd520..ae0f97231ad8084f3787e0d4b172f5c04de15246 100644 (file)
@@ -33,8 +33,9 @@ function getPdf(arg, callback) {
   var xhr = new XMLHttpRequest();
   xhr.open('GET', params.url);
   xhr.mozResponseType = xhr.responseType = 'arraybuffer';
-  xhr.expected = (params.url.indexOf('http:') === 0 ||
-                  params.url.indexOf('https:') === 0) ? 200 : 0;
+  var protocol = params.url.indexOf(':') < 0 ? window.location.protocol :
+    params.url.substring(0, params.url.indexOf(':') + 1);
+  xhr.expected = (protocol === 'http:' || protocol === 'https:') ? 200 : 0;
 
   if ('progress' in params)
     xhr.onprogress = params.progress || undefined;