Explorar o código

PDF.js version 1.0.441

Yury Delendik %!s(int64=10) %!d(string=hai) anos
pai
achega
b4910acc09
Modificáronse 6 ficheiros con 36 adicións e 22 borrados
  1. 1 1
      bower.json
  2. 2 2
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 2 2
      build/pdf.worker.js
  5. 1 1
      package.json
  6. 28 14
      web/compatibility.js

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.439",
+  "version": "1.0.441",
   "keywords": [
     "Mozilla",
     "pdf",

+ 2 - 2
build/pdf.combined.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.439';
-PDFJS.build = '2e98f90';
+PDFJS.version = '1.0.441';
+PDFJS.build = '0ac8380';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it

+ 2 - 2
build/pdf.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.439';
-PDFJS.build = '2e98f90';
+PDFJS.version = '1.0.441';
+PDFJS.build = '0ac8380';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it

+ 2 - 2
build/pdf.worker.js

@@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
   (typeof window !== 'undefined' ? window : this).PDFJS = {};
 }
 
-PDFJS.version = '1.0.439';
-PDFJS.build = '2e98f90';
+PDFJS.version = '1.0.441';
+PDFJS.build = '0ac8380';
 
 (function pdfjsWrapper() {
   // Use strict in our context only - users might not want it

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.0.439",
+  "version": "1.0.441",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [
     "Mozilla",

+ 28 - 14
web/compatibility.js

@@ -481,7 +481,7 @@ if (typeof PDFJS === 'undefined') {
   }
 })();
 
-// Support: IE<11, Chrome<21
+// Support: IE<11, Chrome<21, Android<4.4
 (function checkSetPresenceInImageData() {
   // IE < 11 will use window.CanvasPixelArray which lacks set function.
   if (window.CanvasPixelArray) {
@@ -493,24 +493,38 @@ if (typeof PDFJS === 'undefined') {
       };
     }
   } else {
-    // Chrome < 21 uses an inaccessible CanvasPixelArray prototype.
-    // Because we cannot feature detect it, we rely on user agent.
+    // Old Chrome and Android use an inaccessible CanvasPixelArray prototype.
+    // Because we cannot feature detect it, we rely on user agent parsing.
+    var polyfill = false;
     if (navigator.userAgent.indexOf('Chrom') >= 0) {
       var versionMatch = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
       if (versionMatch && parseInt(versionMatch[2]) < 21) {
-        var contextPrototype = window.CanvasRenderingContext2D.prototype;
-        contextPrototype._createImageData = contextPrototype.createImageData;
-        contextPrototype.createImageData = function(w, h) {
-          var imageData = this._createImageData(w, h);
-          imageData.data.set = function(arr) {
-            for (var i = 0, ii = this.length; i < ii; i++) {
-              this[i] = arr[i];
-            }
-          };
-          return imageData;
-        };
+        // Chrome < 21 lacks the set function.
+        polyfill = true;
+      }
+    } else if (navigator.userAgent.indexOf('Android') >= 0) {
+      // Android < 4.4 lacks the set function.
+      // Android >= 4.4 will contain Chrome in the user agent,
+      // thus pass the Chrome check above and not reach this block.
+      var isOldAndroid = /Android\s[0-4][^\d]/g.test(navigator.userAgent);
+      if (isOldAndroid) {
+        polyfill = true;
       }
     }
+
+    if (polyfill) {
+      var contextPrototype = window.CanvasRenderingContext2D.prototype;
+      contextPrototype._createImageData = contextPrototype.createImageData;
+      contextPrototype.createImageData = function(w, h) {
+        var imageData = this._createImageData(w, h);
+        imageData.data.set = function(arr) {
+          for (var i = 0, ii = this.length; i < ii; i++) {
+            this[i] = arr[i];
+          }
+        };
+        return imageData;
+      };
+    }
   }
 })();