Browse Source

PDF.js version 1.4.23 - See mozilla/pdf.js@252b9d5910b787250e5882e8a50b7eb609a4af15

master v1.4.23
Pdf Bot 9 years ago
parent
commit
cb34a77ab8
  1. 2
      bower.json
  2. 29
      build/pdf.combined.js
  3. 35
      build/pdf.js
  4. 20
      build/pdf.worker.js
  5. 2
      package.json

2
bower.json

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

29
build/pdf.combined.js

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {}));
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
'use strict'; 'use strict';
var pdfjsVersion = '1.4.21'; var pdfjsVersion = '1.4.23';
var pdfjsBuild = 'e44dada'; var pdfjsBuild = '252b9d5';
var pdfjsFilePath = var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ? typeof document !== 'undefined' && document.currentScript ?
@ -9781,6 +9781,21 @@ function combineUrl(baseUrl, url) {
return new URL(url, baseUrl).href; return new URL(url, baseUrl).href;
} }
// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
function isSameOrigin(baseUrl, otherUrl) {
try {
var base = new URL(baseUrl);
if (!base.origin || base.origin === 'null') {
return false; // non-HTTP url
}
} catch (e) {
return false;
}
var other = new URL(otherUrl, base);
return base.origin === other.origin;
}
// Validates if URL is safe and allowed, e.g. to avoid XSS. // Validates if URL is safe and allowed, e.g. to avoid XSS.
function isValidUrl(url, allowRelative) { function isValidUrl(url, allowRelative) {
if (!url) { if (!url) {
@ -11825,6 +11840,7 @@ exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
exports.isInt = isInt; exports.isInt = isInt;
exports.isNum = isNum; exports.isNum = isNum;
exports.isString = isString; exports.isString = isString;
exports.isSameOrigin = isSameOrigin;
exports.isValidUrl = isValidUrl; exports.isValidUrl = isValidUrl;
exports.addLinkAttributes = addLinkAttributes; exports.addLinkAttributes = addLinkAttributes;
exports.loadJpegStream = loadJpegStream; exports.loadJpegStream = loadJpegStream;
@ -31178,6 +31194,7 @@ var error = sharedUtil.error;
var deprecated = sharedUtil.deprecated; var deprecated = sharedUtil.deprecated;
var info = sharedUtil.info; var info = sharedUtil.info;
var isArrayBuffer = sharedUtil.isArrayBuffer; var isArrayBuffer = sharedUtil.isArrayBuffer;
var isSameOrigin = sharedUtil.isSameOrigin;
var loadJpegStream = sharedUtil.loadJpegStream; var loadJpegStream = sharedUtil.loadJpegStream;
var stringToBytes = sharedUtil.stringToBytes; var stringToBytes = sharedUtil.stringToBytes;
var warn = sharedUtil.warn; var warn = sharedUtil.warn;
@ -32334,6 +32351,14 @@ var PDFWorker = (function PDFWorkerClosure() {
return PDFJS.fakeWorkerFilesLoadedCapability.promise; return PDFJS.fakeWorkerFilesLoadedCapability.promise;
} }
function createCDNWrapper(url) {
// We will rely on blob URL's property to specify origin.
// We want this function to fail in case if createObjectURL or Blob do not
// exist or fail for some reason -- our Worker creation will fail anyway.
var wrapper = 'importScripts(\'' + url + '\');';
return URL.createObjectURL(new Blob([wrapper]));
}
function PDFWorker(name) { function PDFWorker(name) {
this.name = name; this.name = name;
this.destroyed = false; this.destroyed = false;

35
build/pdf.js

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
'use strict'; 'use strict';
var pdfjsVersion = '1.4.21'; var pdfjsVersion = '1.4.23';
var pdfjsBuild = 'e44dada'; var pdfjsBuild = '252b9d5';
var pdfjsFilePath = var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ? typeof document !== 'undefined' && document.currentScript ?
@ -416,6 +416,21 @@ function combineUrl(baseUrl, url) {
return new URL(url, baseUrl).href; return new URL(url, baseUrl).href;
} }
// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
function isSameOrigin(baseUrl, otherUrl) {
try {
var base = new URL(baseUrl);
if (!base.origin || base.origin === 'null') {
return false; // non-HTTP url
}
} catch (e) {
return false;
}
var other = new URL(otherUrl, base);
return base.origin === other.origin;
}
// Validates if URL is safe and allowed, e.g. to avoid XSS. // Validates if URL is safe and allowed, e.g. to avoid XSS.
function isValidUrl(url, allowRelative) { function isValidUrl(url, allowRelative) {
if (!url) { if (!url) {
@ -2460,6 +2475,7 @@ exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
exports.isInt = isInt; exports.isInt = isInt;
exports.isNum = isNum; exports.isNum = isNum;
exports.isString = isString; exports.isString = isString;
exports.isSameOrigin = isSameOrigin;
exports.isValidUrl = isValidUrl; exports.isValidUrl = isValidUrl;
exports.addLinkAttributes = addLinkAttributes; exports.addLinkAttributes = addLinkAttributes;
exports.loadJpegStream = loadJpegStream; exports.loadJpegStream = loadJpegStream;
@ -8244,6 +8260,7 @@ var error = sharedUtil.error;
var deprecated = sharedUtil.deprecated; var deprecated = sharedUtil.deprecated;
var info = sharedUtil.info; var info = sharedUtil.info;
var isArrayBuffer = sharedUtil.isArrayBuffer; var isArrayBuffer = sharedUtil.isArrayBuffer;
var isSameOrigin = sharedUtil.isSameOrigin;
var loadJpegStream = sharedUtil.loadJpegStream; var loadJpegStream = sharedUtil.loadJpegStream;
var stringToBytes = sharedUtil.stringToBytes; var stringToBytes = sharedUtil.stringToBytes;
var warn = sharedUtil.warn; var warn = sharedUtil.warn;
@ -9434,6 +9451,14 @@ var PDFWorker = (function PDFWorkerClosure() {
return PDFJS.fakeWorkerFilesLoadedCapability.promise; return PDFJS.fakeWorkerFilesLoadedCapability.promise;
} }
function createCDNWrapper(url) {
// We will rely on blob URL's property to specify origin.
// We want this function to fail in case if createObjectURL or Blob do not
// exist or fail for some reason -- our Worker creation will fail anyway.
var wrapper = 'importScripts(\'' + url + '\');';
return URL.createObjectURL(new Blob([wrapper]));
}
function PDFWorker(name) { function PDFWorker(name) {
this.name = name; this.name = name;
this.destroyed = false; this.destroyed = false;
@ -9468,6 +9493,12 @@ var PDFWorker = (function PDFWorkerClosure() {
var workerSrc = getWorkerSrc(); var workerSrc = getWorkerSrc();
try { try {
// Wraps workerSrc path into blob URL, if the former does not belong
// to the same origin.
if (!isSameOrigin(window.location.href, workerSrc)) {
workerSrc = createCDNWrapper(
combineUrl(window.location.href, workerSrc));
}
// Some versions of FF can't create a worker on localhost, see: // Some versions of FF can't create a worker on localhost, see:
// https://bugzilla.mozilla.org/show_bug.cgi?id=683280 // https://bugzilla.mozilla.org/show_bug.cgi?id=683280
var worker = new Worker(workerSrc); var worker = new Worker(workerSrc);

20
build/pdf.worker.js vendored

@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
'use strict'; 'use strict';
var pdfjsVersion = '1.4.21'; var pdfjsVersion = '1.4.23';
var pdfjsBuild = 'e44dada'; var pdfjsBuild = '252b9d5';
var pdfjsFilePath = var pdfjsFilePath =
typeof document !== 'undefined' && document.currentScript ? typeof document !== 'undefined' && document.currentScript ?
@ -9713,6 +9713,21 @@ function combineUrl(baseUrl, url) {
return new URL(url, baseUrl).href; return new URL(url, baseUrl).href;
} }
// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.
function isSameOrigin(baseUrl, otherUrl) {
try {
var base = new URL(baseUrl);
if (!base.origin || base.origin === 'null') {
return false; // non-HTTP url
}
} catch (e) {
return false;
}
var other = new URL(otherUrl, base);
return base.origin === other.origin;
}
// Validates if URL is safe and allowed, e.g. to avoid XSS. // Validates if URL is safe and allowed, e.g. to avoid XSS.
function isValidUrl(url, allowRelative) { function isValidUrl(url, allowRelative) {
if (!url) { if (!url) {
@ -11757,6 +11772,7 @@ exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
exports.isInt = isInt; exports.isInt = isInt;
exports.isNum = isNum; exports.isNum = isNum;
exports.isString = isString; exports.isString = isString;
exports.isSameOrigin = isSameOrigin;
exports.isValidUrl = isValidUrl; exports.isValidUrl = isValidUrl;
exports.addLinkAttributes = addLinkAttributes; exports.addLinkAttributes = addLinkAttributes;
exports.loadJpegStream = loadJpegStream; exports.loadJpegStream = loadJpegStream;

2
package.json

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

Loading…
Cancel
Save