]> git.parisson.com Git - pdf.js.git/commitdiff
don't cache stream objects
authorAndreas Gal <andreas.gal@gmail.com>
Sun, 5 Jun 2011 06:18:55 +0000 (23:18 -0700)
committerAndreas Gal <andreas.gal@gmail.com>
Sun, 5 Jun 2011 06:18:55 +0000 (23:18 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index 0342ca66fc9397e31aa544f00af93893b635e141..96dc518b5108c0e4a80956a7f71b61d952c320ff 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -1262,12 +1262,9 @@ var XRef = (function() {
         fetch: function(ref) {
             var num = ref.num;
             var e = this.cache[num];
-            if (e) {
-                // The stream might be in use elsewhere, so clone it.
-                if (IsStream(e))
-                    e = e.makeSubStream(e.start, e.length, e.dict);
+            if (e)
                 return e;
-            }
+
             e = this.getEntry(num);
             var gen = ref.gen;
             if (e.uncompressed) {
@@ -1292,7 +1289,11 @@ var XRef = (function() {
                     }
                     error("bad XRef entry");
                 }
-                return this.cache[num] = parser.getObj();
+                e = parser.getObj();
+                // Don't cache streams since they are mutable.
+                if (!IsStream(e))
+                    this.cache[num] = e;
+                return e;
             }
             error("compressed entry");
         },