Browse Source

PDF.js version 1.8.203 - See mozilla/pdf.js@f6d4de989883a63469ff28a7851af6b874e35243

master v1.8.203
pdfjsbot 8 years ago
parent
commit
93b3ecb8d1
  1. 2
      bower.json
  2. 163
      build/pdf.combined.js
  3. 145
      build/pdf.js
  4. 12
      build/pdf.min.js
  5. 127
      build/pdf.worker.js
  6. 20
      build/pdf.worker.min.js
  7. 18
      lib/core/murmurhash3.js
  8. 4
      lib/display/api.js
  9. 11
      lib/display/canvas.js
  10. 9
      lib/display/dom_utils.js
  11. 12
      lib/display/global.js
  12. 4
      lib/pdf.js
  13. 4
      lib/pdf.worker.js
  14. 64
      lib/shared/compatibility.js
  15. 41
      lib/shared/util.js
  16. 2
      lib/test/unit/murmurhash3_spec.js
  17. 2
      package.json
  18. 64
      web/compatibility.js

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.201",
"version": "1.8.203",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

163
build/pdf.combined.js

@ -592,10 +592,10 @@ function readUint32(data, offset) { @@ -592,10 +592,10 @@ function readUint32(data, offset) {
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
}
function isLittleEndian() {
var buffer8 = new Uint8Array(2);
var buffer8 = new Uint8Array(4);
buffer8[0] = 1;
var buffer16 = new Uint16Array(buffer8.buffer);
return buffer16[0] === 1;
var view32 = new Uint32Array(buffer8.buffer, 0, 1);
return view32[0] === 1;
}
function isEvalSupported() {
try {
@ -605,41 +605,6 @@ function isEvalSupported() { @@ -605,41 +605,6 @@ function isEvalSupported() {
return false;
}
}
var Uint32ArrayView = function Uint32ArrayViewClosure() {
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length === undefined ? this.byteLength >> 2 : length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
return Uint32ArrayView;
}();
exports.Uint32ArrayView = Uint32ArrayView;
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
var Util = function UtilClosure() {
function Util() {}
@ -3267,14 +3232,6 @@ var RenderingCancelledException = function RenderingCancelledException() { @@ -3267,14 +3232,6 @@ var RenderingCancelledException = function RenderingCancelledException() {
RenderingCancelledException.constructor = RenderingCancelledException;
return RenderingCancelledException;
}();
var hasCanvasTypedArrays;
hasCanvasTypedArrays = function hasCanvasTypedArrays() {
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
var imageData = ctx.createImageData(1, 1);
return typeof imageData.data.buffer !== 'undefined';
};
var LinkTarget = {
NONE: 0,
SELF: 1,
@ -3389,7 +3346,6 @@ exports.isValidUrl = isValidUrl; @@ -3389,7 +3346,6 @@ exports.isValidUrl = isValidUrl;
exports.getFilenameFromUrl = getFilenameFromUrl;
exports.LinkTarget = LinkTarget;
exports.RenderingCancelledException = RenderingCancelledException;
exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;
@ -12778,8 +12734,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -12778,8 +12734,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}
};
}();
exports.version = '1.8.201';
exports.build = '5feb2a25';
exports.version = '1.8.203';
exports.build = 'f6d4de98';
exports.getDocument = getDocument;
exports.PDFDataRangeTransport = PDFDataRangeTransport;
exports.PDFWorker = PDFWorker;
@ -28040,8 +27996,8 @@ if (!globalScope.PDFJS) { @@ -28040,8 +27996,8 @@ if (!globalScope.PDFJS) {
globalScope.PDFJS = {};
}
var PDFJS = globalScope.PDFJS;
PDFJS.version = '1.8.201';
PDFJS.build = '5feb2a25';
PDFJS.version = '1.8.203';
PDFJS.build = 'f6d4de98';
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
sharedUtil.setVerbosityLevel(PDFJS.verbosity);
@ -28127,13 +28083,7 @@ if (savedOpenExternalLinksInNewWindow) { @@ -28127,13 +28083,7 @@ if (savedOpenExternalLinksInNewWindow) {
PDFJS.getDocument = displayAPI.getDocument;
PDFJS.PDFDataRangeTransport = displayAPI.PDFDataRangeTransport;
PDFJS.PDFWorker = displayAPI.PDFWorker;
Object.defineProperty(PDFJS, 'hasCanvasTypedArrays', {
configurable: true,
get: function PDFJS_hasCanvasTypedArrays() {
var value = displayDOMUtils.hasCanvasTypedArrays();
return sharedUtil.shadow(PDFJS, 'hasCanvasTypedArrays', value);
}
});
PDFJS.hasCanvasTypedArrays = true;
PDFJS.CustomStyle = displayDOMUtils.CustomStyle;
PDFJS.LinkTarget = LinkTarget;
PDFJS.addLinkAttributes = displayDOMUtils.addLinkAttributes;
@ -38860,7 +38810,6 @@ exports.getMetrics = getMetrics; @@ -38860,7 +38810,6 @@ exports.getMetrics = getMetrics;
var sharedUtil = __w_pdfjs_require__(0);
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
var MASK_HIGH = 0xffff0000;
var MASK_LOW = 0xffff;
@ -38869,15 +38818,8 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { @@ -38869,15 +38818,8 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
this.h1 = seed ? seed & 0xffffffff : SEED;
this.h2 = seed ? seed & 0xffffffff : SEED;
}
var alwaysUseUint32ArrayView = false;
try {
new Uint32Array(new Uint8Array(5).buffer, 0, 1);
} catch (e) {
alwaysUseUint32ArrayView = true;
}
MurmurHash3_64.prototype = {
update: function MurmurHash3_64_update(input) {
var useUint32ArrayView = alwaysUseUint32ArrayView;
var i;
if (typeof input === 'string') {
var data = new Uint8Array(input.length * 2);
@ -38891,19 +38833,15 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { @@ -38891,19 +38833,15 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
data[length++] = code & 0xff;
}
}
} else if (input instanceof Uint8Array) {
data = input;
length = data.length;
} else if (typeof input === 'object' && 'length' in input) {
} else if (typeof input === 'object' && 'byteLength' in input) {
data = input;
length = data.length;
useUint32ArrayView = true;
length = data.byteLength;
} else {
throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
}
var blockCounts = length >> 2;
var tailLength = length - blockCounts * 4;
var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
var k1 = 0;
var k2 = 0;
var h1 = this.h1;
@ -41200,7 +41138,6 @@ var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX; @@ -41200,7 +41138,6 @@ var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
var ImageKind = sharedUtil.ImageKind;
var OPS = sharedUtil.OPS;
var TextRenderingMode = sharedUtil.TextRenderingMode;
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var info = sharedUtil.info;
@ -41213,7 +41150,6 @@ var warn = sharedUtil.warn; @@ -41213,7 +41150,6 @@ var warn = sharedUtil.warn;
var TilingPattern = displayPatternHelper.TilingPattern;
var getShadingPatternFromIR = displayPatternHelper.getShadingPatternFromIR;
var WebGLUtils = displayWebGL.WebGLUtils;
var hasCanvasTypedArrays = displayDOMUtils.hasCanvasTypedArrays;
var MIN_FONT_SIZE = 16;
var MAX_FONT_SIZE = 100;
var MAX_GROUP_SIZE = 4096;
@ -41221,11 +41157,6 @@ var MIN_WIDTH_FACTOR = 0.65; @@ -41221,11 +41157,6 @@ var MIN_WIDTH_FACTOR = 0.65;
var COMPILE_TYPE3_GLYPHS = true;
var MAX_SIZE_TO_COMPILE = 1000;
var FULL_CHUNK_HEIGHT = 16;
var HasCanvasTypedArraysCached = {
get value() {
return shadow(HasCanvasTypedArraysCached, 'value', hasCanvasTypedArrays());
}
};
var IsLittleEndianCached = {
get value() {
return shadow(IsLittleEndianCached, 'value', isLittleEndian());
@ -41560,11 +41491,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { @@ -41560,11 +41491,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
var i, j, thisChunkHeight, elemsInThisChunk;
if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {
var srcLength = src.byteLength;
var dest32 = HasCanvasTypedArraysCached.value ? new Uint32Array(dest.buffer) : new Uint32ArrayView(dest);
var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
var dest32DataLength = dest32.length;
var fullSrcDiff = width + 7 >> 3;
var white = 0xFFFFFFFF;
var black = IsLittleEndianCached.value || !HasCanvasTypedArraysCached.value ? 0xFF000000 : 0x000000FF;
var black = IsLittleEndianCached.value ? 0xFF000000 : 0x000000FF;
for (i = 0; i < totalChunks; i++) {
thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
destPos = 0;
@ -43578,8 +43509,8 @@ exports.TilingPattern = TilingPattern; @@ -43578,8 +43509,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.201';
var pdfjsBuild = '5feb2a25';
var pdfjsVersion = '1.8.203';
var pdfjsBuild = 'f6d4de98';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
var pdfjsDisplayAPI = __w_pdfjs_require__(10);
@ -43665,6 +43596,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -43665,6 +43596,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
this[offset] = array[i] & 0xFF;
}
}
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
function TypedArray(arg1) {
var result, i, n;
if (typeof arg1 === 'number') {
@ -43691,11 +43653,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -43691,11 +43653,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
}
globalScope.Uint8Array = TypedArray;
globalScope.Int8Array = TypedArray;
globalScope.Uint32Array = TypedArray;
globalScope.Int32Array = TypedArray;
globalScope.Uint16Array = TypedArray;
globalScope.Float32Array = TypedArray;
globalScope.Float64Array = TypedArray;
globalScope.Uint32Array = function () {
if (arguments.length === 3) {
if (arguments[1] !== 0) {
throw new Error('offset !== 0 is not supported');
}
return new Uint32ArrayView(arguments[0], arguments[2]);
}
return TypedArray.apply(this, arguments);
};
})();
(function canvasPixelArrayBuffer() {
if (!hasDOM || !window.CanvasPixelArray) {
return;
}
var cpaProto = window.CanvasPixelArray.prototype;
if ('buffer' in cpaProto) {
return;
}
Object.defineProperty(cpaProto, 'buffer', {
get: function () {
return this;
},
enumerable: false,
configurable: true
});
Object.defineProperty(cpaProto, 'byteLength', {
get: function () {
return this.length;
},
enumerable: false,
configurable: true
});
})();
(function normalizeURLObject() {
if (!globalScope.URL) {

145
build/pdf.js

@ -592,10 +592,10 @@ function readUint32(data, offset) { @@ -592,10 +592,10 @@ function readUint32(data, offset) {
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
}
function isLittleEndian() {
var buffer8 = new Uint8Array(2);
var buffer8 = new Uint8Array(4);
buffer8[0] = 1;
var buffer16 = new Uint16Array(buffer8.buffer);
return buffer16[0] === 1;
var view32 = new Uint32Array(buffer8.buffer, 0, 1);
return view32[0] === 1;
}
function isEvalSupported() {
try {
@ -605,41 +605,6 @@ function isEvalSupported() { @@ -605,41 +605,6 @@ function isEvalSupported() {
return false;
}
}
var Uint32ArrayView = function Uint32ArrayViewClosure() {
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length === undefined ? this.byteLength >> 2 : length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
return Uint32ArrayView;
}();
exports.Uint32ArrayView = Uint32ArrayView;
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
var Util = function UtilClosure() {
function Util() {}
@ -1337,14 +1302,6 @@ var RenderingCancelledException = function RenderingCancelledException() { @@ -1337,14 +1302,6 @@ var RenderingCancelledException = function RenderingCancelledException() {
RenderingCancelledException.constructor = RenderingCancelledException;
return RenderingCancelledException;
}();
var hasCanvasTypedArrays;
hasCanvasTypedArrays = function hasCanvasTypedArrays() {
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
var imageData = ctx.createImageData(1, 1);
return typeof imageData.data.buffer !== 'undefined';
};
var LinkTarget = {
NONE: 0,
SELF: 1,
@ -1459,7 +1416,6 @@ exports.isValidUrl = isValidUrl; @@ -1459,7 +1416,6 @@ exports.isValidUrl = isValidUrl;
exports.getFilenameFromUrl = getFilenameFromUrl;
exports.LinkTarget = LinkTarget;
exports.RenderingCancelledException = RenderingCancelledException;
exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;
@ -3492,8 +3448,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -3492,8 +3448,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}
};
}();
exports.version = '1.8.201';
exports.build = '5feb2a25';
exports.version = '1.8.203';
exports.build = 'f6d4de98';
exports.getDocument = getDocument;
exports.PDFDataRangeTransport = PDFDataRangeTransport;
exports.PDFWorker = PDFWorker;
@ -5432,8 +5388,8 @@ if (!globalScope.PDFJS) { @@ -5432,8 +5388,8 @@ if (!globalScope.PDFJS) {
globalScope.PDFJS = {};
}
var PDFJS = globalScope.PDFJS;
PDFJS.version = '1.8.201';
PDFJS.build = '5feb2a25';
PDFJS.version = '1.8.203';
PDFJS.build = 'f6d4de98';
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
sharedUtil.setVerbosityLevel(PDFJS.verbosity);
@ -5519,13 +5475,7 @@ if (savedOpenExternalLinksInNewWindow) { @@ -5519,13 +5475,7 @@ if (savedOpenExternalLinksInNewWindow) {
PDFJS.getDocument = displayAPI.getDocument;
PDFJS.PDFDataRangeTransport = displayAPI.PDFDataRangeTransport;
PDFJS.PDFWorker = displayAPI.PDFWorker;
Object.defineProperty(PDFJS, 'hasCanvasTypedArrays', {
configurable: true,
get: function PDFJS_hasCanvasTypedArrays() {
var value = displayDOMUtils.hasCanvasTypedArrays();
return sharedUtil.shadow(PDFJS, 'hasCanvasTypedArrays', value);
}
});
PDFJS.hasCanvasTypedArrays = true;
PDFJS.CustomStyle = displayDOMUtils.CustomStyle;
PDFJS.LinkTarget = LinkTarget;
PDFJS.addLinkAttributes = displayDOMUtils.addLinkAttributes;
@ -5556,7 +5506,6 @@ var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX; @@ -5556,7 +5506,6 @@ var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
var ImageKind = sharedUtil.ImageKind;
var OPS = sharedUtil.OPS;
var TextRenderingMode = sharedUtil.TextRenderingMode;
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var info = sharedUtil.info;
@ -5569,7 +5518,6 @@ var warn = sharedUtil.warn; @@ -5569,7 +5518,6 @@ var warn = sharedUtil.warn;
var TilingPattern = displayPatternHelper.TilingPattern;
var getShadingPatternFromIR = displayPatternHelper.getShadingPatternFromIR;
var WebGLUtils = displayWebGL.WebGLUtils;
var hasCanvasTypedArrays = displayDOMUtils.hasCanvasTypedArrays;
var MIN_FONT_SIZE = 16;
var MAX_FONT_SIZE = 100;
var MAX_GROUP_SIZE = 4096;
@ -5577,11 +5525,6 @@ var MIN_WIDTH_FACTOR = 0.65; @@ -5577,11 +5525,6 @@ var MIN_WIDTH_FACTOR = 0.65;
var COMPILE_TYPE3_GLYPHS = true;
var MAX_SIZE_TO_COMPILE = 1000;
var FULL_CHUNK_HEIGHT = 16;
var HasCanvasTypedArraysCached = {
get value() {
return shadow(HasCanvasTypedArraysCached, 'value', hasCanvasTypedArrays());
}
};
var IsLittleEndianCached = {
get value() {
return shadow(IsLittleEndianCached, 'value', isLittleEndian());
@ -5916,11 +5859,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { @@ -5916,11 +5859,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
var i, j, thisChunkHeight, elemsInThisChunk;
if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {
var srcLength = src.byteLength;
var dest32 = HasCanvasTypedArraysCached.value ? new Uint32Array(dest.buffer) : new Uint32ArrayView(dest);
var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
var dest32DataLength = dest32.length;
var fullSrcDiff = width + 7 >> 3;
var white = 0xFFFFFFFF;
var black = IsLittleEndianCached.value || !HasCanvasTypedArraysCached.value ? 0xFF000000 : 0x000000FF;
var black = IsLittleEndianCached.value ? 0xFF000000 : 0x000000FF;
for (i = 0; i < totalChunks; i++) {
thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
destPos = 0;
@ -7934,8 +7877,8 @@ exports.TilingPattern = TilingPattern; @@ -7934,8 +7877,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.201';
var pdfjsBuild = '5feb2a25';
var pdfjsVersion = '1.8.203';
var pdfjsBuild = 'f6d4de98';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
@ -8021,6 +7964,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -8021,6 +7964,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
this[offset] = array[i] & 0xFF;
}
}
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
function TypedArray(arg1) {
var result, i, n;
if (typeof arg1 === 'number') {
@ -8047,11 +8021,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -8047,11 +8021,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
}
globalScope.Uint8Array = TypedArray;
globalScope.Int8Array = TypedArray;
globalScope.Uint32Array = TypedArray;
globalScope.Int32Array = TypedArray;
globalScope.Uint16Array = TypedArray;
globalScope.Float32Array = TypedArray;
globalScope.Float64Array = TypedArray;
globalScope.Uint32Array = function () {
if (arguments.length === 3) {
if (arguments[1] !== 0) {
throw new Error('offset !== 0 is not supported');
}
return new Uint32ArrayView(arguments[0], arguments[2]);
}
return TypedArray.apply(this, arguments);
};
})();
(function canvasPixelArrayBuffer() {
if (!hasDOM || !window.CanvasPixelArray) {
return;
}
var cpaProto = window.CanvasPixelArray.prototype;
if ('buffer' in cpaProto) {
return;
}
Object.defineProperty(cpaProto, 'buffer', {
get: function () {
return this;
},
enumerable: false,
configurable: true
});
Object.defineProperty(cpaProto, 'byteLength', {
get: function () {
return this.length;
},
enumerable: false,
configurable: true
});
})();
(function normalizeURLObject() {
if (!globalScope.URL) {

12
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

127
build/pdf.worker.js vendored

@ -592,10 +592,10 @@ function readUint32(data, offset) { @@ -592,10 +592,10 @@ function readUint32(data, offset) {
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
}
function isLittleEndian() {
var buffer8 = new Uint8Array(2);
var buffer8 = new Uint8Array(4);
buffer8[0] = 1;
var buffer16 = new Uint16Array(buffer8.buffer);
return buffer16[0] === 1;
var view32 = new Uint32Array(buffer8.buffer, 0, 1);
return view32[0] === 1;
}
function isEvalSupported() {
try {
@ -605,41 +605,6 @@ function isEvalSupported() { @@ -605,41 +605,6 @@ function isEvalSupported() {
return false;
}
}
var Uint32ArrayView = function Uint32ArrayViewClosure() {
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length === undefined ? this.byteLength >> 2 : length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
return Uint32ArrayView;
}();
exports.Uint32ArrayView = Uint32ArrayView;
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
var Util = function UtilClosure() {
function Util() {}
@ -35148,7 +35113,6 @@ exports.getMetrics = getMetrics; @@ -35148,7 +35113,6 @@ exports.getMetrics = getMetrics;
var sharedUtil = __w_pdfjs_require__(0);
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
var MASK_HIGH = 0xffff0000;
var MASK_LOW = 0xffff;
@ -35157,15 +35121,8 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { @@ -35157,15 +35121,8 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
this.h1 = seed ? seed & 0xffffffff : SEED;
this.h2 = seed ? seed & 0xffffffff : SEED;
}
var alwaysUseUint32ArrayView = false;
try {
new Uint32Array(new Uint8Array(5).buffer, 0, 1);
} catch (e) {
alwaysUseUint32ArrayView = true;
}
MurmurHash3_64.prototype = {
update: function MurmurHash3_64_update(input) {
var useUint32ArrayView = alwaysUseUint32ArrayView;
var i;
if (typeof input === 'string') {
var data = new Uint8Array(input.length * 2);
@ -35179,19 +35136,15 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { @@ -35179,19 +35136,15 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
data[length++] = code & 0xff;
}
}
} else if (input instanceof Uint8Array) {
data = input;
length = data.length;
} else if (typeof input === 'object' && 'length' in input) {
} else if (typeof input === 'object' && 'byteLength' in input) {
data = input;
length = data.length;
useUint32ArrayView = true;
length = data.byteLength;
} else {
throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
}
var blockCounts = length >> 2;
var tailLength = length - blockCounts * 4;
var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
var k1 = 0;
var k2 = 0;
var h1 = this.h1;
@ -36985,8 +36938,8 @@ exports.Type1Parser = Type1Parser; @@ -36985,8 +36938,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.201';
var pdfjsBuild = '5feb2a25';
var pdfjsVersion = '1.8.203';
var pdfjsBuild = 'f6d4de98';
var pdfjsCoreWorker = __w_pdfjs_require__(8);
{
__w_pdfjs_require__(19);
@ -37044,6 +36997,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -37044,6 +36997,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
this[offset] = array[i] & 0xFF;
}
}
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
function TypedArray(arg1) {
var result, i, n;
if (typeof arg1 === 'number') {
@ -37070,11 +37054,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -37070,11 +37054,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
}
globalScope.Uint8Array = TypedArray;
globalScope.Int8Array = TypedArray;
globalScope.Uint32Array = TypedArray;
globalScope.Int32Array = TypedArray;
globalScope.Uint16Array = TypedArray;
globalScope.Float32Array = TypedArray;
globalScope.Float64Array = TypedArray;
globalScope.Uint32Array = function () {
if (arguments.length === 3) {
if (arguments[1] !== 0) {
throw new Error('offset !== 0 is not supported');
}
return new Uint32ArrayView(arguments[0], arguments[2]);
}
return TypedArray.apply(this, arguments);
};
})();
(function canvasPixelArrayBuffer() {
if (!hasDOM || !window.CanvasPixelArray) {
return;
}
var cpaProto = window.CanvasPixelArray.prototype;
if ('buffer' in cpaProto) {
return;
}
Object.defineProperty(cpaProto, 'buffer', {
get: function () {
return this;
},
enumerable: false,
configurable: true
});
Object.defineProperty(cpaProto, 'byteLength', {
get: function () {
return this.length;
},
enumerable: false,
configurable: true
});
})();
(function normalizeURLObject() {
if (!globalScope.URL) {

20
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

18
lib/core/murmurhash3.js

@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
'use strict';
var sharedUtil = require('../shared/util.js');
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
var MASK_HIGH = 0xffff0000;
var MASK_LOW = 0xffff;
@ -24,15 +23,8 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { @@ -24,15 +23,8 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
this.h1 = seed ? seed & 0xffffffff : SEED;
this.h2 = seed ? seed & 0xffffffff : SEED;
}
var alwaysUseUint32ArrayView = false;
try {
new Uint32Array(new Uint8Array(5).buffer, 0, 1);
} catch (e) {
alwaysUseUint32ArrayView = true;
}
MurmurHash3_64.prototype = {
update: function MurmurHash3_64_update(input) {
var useUint32ArrayView = alwaysUseUint32ArrayView;
var i;
if (typeof input === 'string') {
var data = new Uint8Array(input.length * 2);
@ -46,19 +38,15 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) { @@ -46,19 +38,15 @@ var MurmurHash3_64 = function MurmurHash3_64Closure(seed) {
data[length++] = code & 0xff;
}
}
} else if (input instanceof Uint8Array) {
data = input;
length = data.length;
} else if (typeof input === 'object' && 'length' in input) {
} else if (typeof input === 'object' && 'byteLength' in input) {
data = input;
length = data.length;
useUint32ArrayView = true;
length = data.byteLength;
} else {
throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
}
var blockCounts = length >> 2;
var tailLength = length - blockCounts * 4;
var dataUint32 = useUint32ArrayView ? new Uint32ArrayView(data, blockCounts) : new Uint32Array(data.buffer, 0, blockCounts);
var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
var k1 = 0;
var k2 = 0;
var h1 = this.h1;

4
lib/display/api.js

@ -1379,8 +1379,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1379,8 +1379,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}
};
}();
exports.version = '1.8.201';
exports.build = '5feb2a25';
exports.version = '1.8.203';
exports.build = 'f6d4de98';
exports.getDocument = getDocument;
exports.PDFDataRangeTransport = PDFDataRangeTransport;
exports.PDFWorker = PDFWorker;

11
lib/display/canvas.js

@ -23,7 +23,6 @@ var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX; @@ -23,7 +23,6 @@ var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX;
var ImageKind = sharedUtil.ImageKind;
var OPS = sharedUtil.OPS;
var TextRenderingMode = sharedUtil.TextRenderingMode;
var Uint32ArrayView = sharedUtil.Uint32ArrayView;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var info = sharedUtil.info;
@ -36,7 +35,6 @@ var warn = sharedUtil.warn; @@ -36,7 +35,6 @@ var warn = sharedUtil.warn;
var TilingPattern = displayPatternHelper.TilingPattern;
var getShadingPatternFromIR = displayPatternHelper.getShadingPatternFromIR;
var WebGLUtils = displayWebGL.WebGLUtils;
var hasCanvasTypedArrays = displayDOMUtils.hasCanvasTypedArrays;
var MIN_FONT_SIZE = 16;
var MAX_FONT_SIZE = 100;
var MAX_GROUP_SIZE = 4096;
@ -44,11 +42,6 @@ var MIN_WIDTH_FACTOR = 0.65; @@ -44,11 +42,6 @@ var MIN_WIDTH_FACTOR = 0.65;
var COMPILE_TYPE3_GLYPHS = true;
var MAX_SIZE_TO_COMPILE = 1000;
var FULL_CHUNK_HEIGHT = 16;
var HasCanvasTypedArraysCached = {
get value() {
return shadow(HasCanvasTypedArraysCached, 'value', hasCanvasTypedArrays());
}
};
var IsLittleEndianCached = {
get value() {
return shadow(IsLittleEndianCached, 'value', isLittleEndian());
@ -383,11 +376,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { @@ -383,11 +376,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
var i, j, thisChunkHeight, elemsInThisChunk;
if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {
var srcLength = src.byteLength;
var dest32 = HasCanvasTypedArraysCached.value ? new Uint32Array(dest.buffer) : new Uint32ArrayView(dest);
var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2);
var dest32DataLength = dest32.length;
var fullSrcDiff = width + 7 >> 3;
var white = 0xFFFFFFFF;
var black = IsLittleEndianCached.value || !HasCanvasTypedArraysCached.value ? 0xFF000000 : 0x000000FF;
var black = IsLittleEndianCached.value ? 0xFF000000 : 0x000000FF;
for (i = 0; i < totalChunks; i++) {
thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight;
destPos = 0;

9
lib/display/dom_utils.js

@ -137,14 +137,6 @@ var RenderingCancelledException = function RenderingCancelledException() { @@ -137,14 +137,6 @@ var RenderingCancelledException = function RenderingCancelledException() {
RenderingCancelledException.constructor = RenderingCancelledException;
return RenderingCancelledException;
}();
var hasCanvasTypedArrays;
hasCanvasTypedArrays = function hasCanvasTypedArrays() {
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
var imageData = ctx.createImageData(1, 1);
return typeof imageData.data.buffer !== 'undefined';
};
var LinkTarget = {
NONE: 0,
SELF: 1,
@ -259,7 +251,6 @@ exports.isValidUrl = isValidUrl; @@ -259,7 +251,6 @@ exports.isValidUrl = isValidUrl;
exports.getFilenameFromUrl = getFilenameFromUrl;
exports.LinkTarget = LinkTarget;
exports.RenderingCancelledException = RenderingCancelledException;
exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;

12
lib/display/global.js

@ -31,8 +31,8 @@ if (!globalScope.PDFJS) { @@ -31,8 +31,8 @@ if (!globalScope.PDFJS) {
globalScope.PDFJS = {};
}
var PDFJS = globalScope.PDFJS;
PDFJS.version = '1.8.201';
PDFJS.build = '5feb2a25';
PDFJS.version = '1.8.203';
PDFJS.build = 'f6d4de98';
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
sharedUtil.setVerbosityLevel(PDFJS.verbosity);
@ -118,13 +118,7 @@ if (savedOpenExternalLinksInNewWindow) { @@ -118,13 +118,7 @@ if (savedOpenExternalLinksInNewWindow) {
PDFJS.getDocument = displayAPI.getDocument;
PDFJS.PDFDataRangeTransport = displayAPI.PDFDataRangeTransport;
PDFJS.PDFWorker = displayAPI.PDFWorker;
Object.defineProperty(PDFJS, 'hasCanvasTypedArrays', {
configurable: true,
get: function PDFJS_hasCanvasTypedArrays() {
var value = displayDOMUtils.hasCanvasTypedArrays();
return sharedUtil.shadow(PDFJS, 'hasCanvasTypedArrays', value);
}
});
PDFJS.hasCanvasTypedArrays = true;
PDFJS.CustomStyle = displayDOMUtils.CustomStyle;
PDFJS.LinkTarget = LinkTarget;
PDFJS.addLinkAttributes = displayDOMUtils.addLinkAttributes;

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.201';
var pdfjsBuild = '5feb2a25';
var pdfjsVersion = '1.8.203';
var pdfjsBuild = 'f6d4de98';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.201';
var pdfjsBuild = '5feb2a25';
var pdfjsVersion = '1.8.203';
var pdfjsBuild = 'f6d4de98';
var pdfjsCoreWorker = require('./core/worker.js');
{
require('./core/network.js');

64
lib/shared/compatibility.js

@ -58,6 +58,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -58,6 +58,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
this[offset] = array[i] & 0xFF;
}
}
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
function TypedArray(arg1) {
var result, i, n;
if (typeof arg1 === 'number') {
@ -84,11 +115,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -84,11 +115,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
}
globalScope.Uint8Array = TypedArray;
globalScope.Int8Array = TypedArray;
globalScope.Uint32Array = TypedArray;
globalScope.Int32Array = TypedArray;
globalScope.Uint16Array = TypedArray;
globalScope.Float32Array = TypedArray;
globalScope.Float64Array = TypedArray;
globalScope.Uint32Array = function () {
if (arguments.length === 3) {
if (arguments[1] !== 0) {
throw new Error('offset !== 0 is not supported');
}
return new Uint32ArrayView(arguments[0], arguments[2]);
}
return TypedArray.apply(this, arguments);
};
})();
(function canvasPixelArrayBuffer() {
if (!hasDOM || !window.CanvasPixelArray) {
return;
}
var cpaProto = window.CanvasPixelArray.prototype;
if ('buffer' in cpaProto) {
return;
}
Object.defineProperty(cpaProto, 'buffer', {
get: function () {
return this;
},
enumerable: false,
configurable: true
});
Object.defineProperty(cpaProto, 'byteLength', {
get: function () {
return this.length;
},
enumerable: false,
configurable: true
});
})();
(function normalizeURLObject() {
if (!globalScope.URL) {

41
lib/shared/util.js

@ -508,10 +508,10 @@ function readUint32(data, offset) { @@ -508,10 +508,10 @@ function readUint32(data, offset) {
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
}
function isLittleEndian() {
var buffer8 = new Uint8Array(2);
var buffer8 = new Uint8Array(4);
buffer8[0] = 1;
var buffer16 = new Uint16Array(buffer8.buffer);
return buffer16[0] === 1;
var view32 = new Uint32Array(buffer8.buffer, 0, 1);
return view32[0] === 1;
}
function isEvalSupported() {
try {
@ -521,41 +521,6 @@ function isEvalSupported() { @@ -521,41 +521,6 @@ function isEvalSupported() {
return false;
}
}
var Uint32ArrayView = function Uint32ArrayViewClosure() {
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length === undefined ? this.byteLength >> 2 : length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
return Uint32ArrayView;
}();
exports.Uint32ArrayView = Uint32ArrayView;
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
var Util = function UtilClosure() {
function Util() {}

2
lib/test/unit/murmurhash3_spec.js

@ -40,7 +40,7 @@ describe('MurmurHash3_64', function () { @@ -40,7 +40,7 @@ describe('MurmurHash3_64', function () {
});
it('correctly generates a hash from a Uint32Array', function () {
var hash = new MurmurHash3_64();
hash.update(new Uint32Array(sourceCharCodes));
hash.update(new Uint32Array(new Uint8Array(sourceCharCodes).buffer));
expect(hash.hexdigest()).toEqual(hexDigestExpected);
});
it('changes the hash after update without seed', function () {

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "1.8.201",
"version": "1.8.203",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

64
web/compatibility.js

@ -142,6 +142,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -142,6 +142,37 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
this[offset] = array[i] & 0xFF;
}
}
function Uint32ArrayView(buffer, length) {
this.buffer = buffer;
this.byteLength = buffer.length;
this.length = length;
ensureUint32ArrayViewProps(this.length);
}
Uint32ArrayView.prototype = Object.create(null);
var uint32ArrayViewSetters = 0;
function createUint32ArrayProp(index) {
return {
get: function () {
var buffer = this.buffer,
offset = index << 2;
return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
},
set: function (value) {
var buffer = this.buffer,
offset = index << 2;
buffer[offset] = value & 255;
buffer[offset + 1] = value >> 8 & 255;
buffer[offset + 2] = value >> 16 & 255;
buffer[offset + 3] = value >>> 24 & 255;
}
};
}
function ensureUint32ArrayViewProps(length) {
while (uint32ArrayViewSetters < length) {
Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
uint32ArrayViewSetters++;
}
}
function TypedArray(arg1) {
var result, i, n;
if (typeof arg1 === 'number') {
@ -168,11 +199,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -168,11 +199,42 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
}
globalScope.Uint8Array = TypedArray;
globalScope.Int8Array = TypedArray;
globalScope.Uint32Array = TypedArray;
globalScope.Int32Array = TypedArray;
globalScope.Uint16Array = TypedArray;
globalScope.Float32Array = TypedArray;
globalScope.Float64Array = TypedArray;
globalScope.Uint32Array = function () {
if (arguments.length === 3) {
if (arguments[1] !== 0) {
throw new Error('offset !== 0 is not supported');
}
return new Uint32ArrayView(arguments[0], arguments[2]);
}
return TypedArray.apply(this, arguments);
};
})();
(function canvasPixelArrayBuffer() {
if (!hasDOM || !window.CanvasPixelArray) {
return;
}
var cpaProto = window.CanvasPixelArray.prototype;
if ('buffer' in cpaProto) {
return;
}
Object.defineProperty(cpaProto, 'buffer', {
get: function () {
return this;
},
enumerable: false,
configurable: true
});
Object.defineProperty(cpaProto, 'byteLength', {
get: function () {
return this.length;
},
enumerable: false,
configurable: true
});
})();
(function normalizeURLObject() {
if (!globalScope.URL) {

Loading…
Cancel
Save