]> git.parisson.com Git - pdf.js.git/commitdiff
fix for new XHR2 binary API
authorAndreas Gal <andreas.gal@gmail.com>
Thu, 12 May 2011 23:58:19 +0000 (16:58 -0700)
committerAndreas Gal <andreas.gal@gmail.com>
Thu, 12 May 2011 23:58:19 +0000 (16:58 -0700)
pdf.js
test.html

diff --git a/pdf.js b/pdf.js
index 750cec1700213b6a554f55a05fabcd4a1d43298a..a468da987ac5f6fef99c7255ce60e58c8e54b117 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -2300,16 +2300,16 @@ var CanvasGraphics = (function() {
 })();
 
 function runParseTests() {
-    //var data = snarf("simple_graphics.pdf", "binary");
-    var data = snarf("/tmp/paper.pdf", "binary");
+    var data = snarf("paper.pdf", "binary");
     var pdf = new PDFDoc(new Stream(data));
     var page = pdf.getPage(1);
-    //page.display();
+    page.display({
+        beginDrawing: function() {}
+    });
 }
 
 if ("arguments" in this) {
     const cmds = {
-        "-e": runEchoTests,
         "-p": runParseTests
     }
     for (n in arguments) {
index 5addd3a1b2e89e811ca332de4740602b244d299d..163cddd74481c490c6c3d9c6c47b6be9dd406550 100644 (file)
--- a/test.html
+++ b/test.html
@@ -29,6 +29,7 @@ function load() {
 
     req = new XMLHttpRequest();
     req.open("GET", "uncompressed.tracemonkey-pldi-09.pdf");
+    req.mozResponseType = "arraybuffer";
     req.expected = 0; // 200 for HTTP
     req.onreadystatechange = xhrstate;
     req.send(null);
@@ -36,7 +37,7 @@ function load() {
 
 function xhrstate() {
     if (req.readyState == 4 && req.status == req.expected) {
-        var data = req.mozResponseArrayBuffer;
+        var data = req.mozResponseArrayBuffer || req.mozResponse;
         pdf = new PDFDoc(new Stream(data));
         numPages = pdf.numPages;
         displayPage(1);