Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pdfjs-dist

Package Overview
Dependencies
Maintainers
3
Versions
1544
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdfjs-dist - npm Package Compare versions

Comparing version 2.0.449 to 2.0.451

lib/display/xml_parser.js

2

bower.json
{
"name": "pdfjs-dist",
"version": "2.0.449",
"version": "2.0.451",
"main": [

@@ -5,0 +5,0 @@ "build/pdf.js",

@@ -226,3 +226,3 @@ /**

var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.449';
var workerVersion = '2.0.451';
if (apiVersion !== null && apiVersion !== workerVersion) {

@@ -229,0 +229,0 @@ throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));

@@ -237,3 +237,3 @@ /**

docId: docId,
apiVersion: '2.0.449',
apiVersion: '2.0.451',
source: {

@@ -1669,4 +1669,4 @@ data: source.data,

{
exports.version = version = '2.0.449';
exports.build = build = 'b67f117b';
exports.version = version = '2.0.451';
exports.build = build = '24f766b1';
}

@@ -1673,0 +1673,0 @@ exports.getDocument = getDocument;

@@ -27,3 +27,3 @@ /**

});
exports.DummyStatTimer = exports.StatTimer = exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.getFilenameFromUrl = exports.addLinkAttributes = exports.RenderingCancelledException = undefined;
exports.DummyStatTimer = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.getFilenameFromUrl = exports.addLinkAttributes = exports.RenderingCancelledException = undefined;

@@ -177,132 +177,2 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var SimpleDOMNode = function () {
function SimpleDOMNode(nodeName, nodeValue) {
_classCallCheck(this, SimpleDOMNode);
this.nodeName = nodeName;
this.nodeValue = nodeValue;
Object.defineProperty(this, 'parentNode', {
value: null,
writable: true
});
}
_createClass(SimpleDOMNode, [{
key: 'hasChildNodes',
value: function hasChildNodes() {
return this.childNodes && this.childNodes.length > 0;
}
}, {
key: 'firstChild',
get: function get() {
return this.childNodes[0];
}
}, {
key: 'nextSibling',
get: function get() {
var index = this.parentNode.childNodes.indexOf(this);
return this.parentNode.childNodes[index + 1];
}
}, {
key: 'textContent',
get: function get() {
if (!this.childNodes) {
return this.nodeValue || '';
}
return this.childNodes.map(function (child) {
return child.textContent;
}).join('');
}
}]);
return SimpleDOMNode;
}();
var SimpleXMLParser = function () {
function SimpleXMLParser() {
_classCallCheck(this, SimpleXMLParser);
}
_createClass(SimpleXMLParser, [{
key: 'parseFromString',
value: function parseFromString(data) {
var _this2 = this;
var nodes = [];
data = data.replace(/<\?[\s\S]*?\?>|<!--[\s\S]*?-->/g, '').trim();
data = data.replace(/<!DOCTYPE[^>\[]+(\[[^\]]+)?[^>]+>/g, '').trim();
data = data.replace(/>([^<][\s\S]*?)</g, function (all, text) {
var length = nodes.length;
var node = new SimpleDOMNode('#text', _this2._decodeXML(text));
nodes.push(node);
if (node.textContent.trim().length === 0) {
return '><';
}
return '>' + length + ',<';
});
data = data.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, function (all, text) {
var length = nodes.length;
var node = new SimpleDOMNode('#text', text);
nodes.push(node);
return length + ',';
});
var regex = /<([\w\:]+)((?:[\s\w:=]|'[^']*'|"[^"]*")*)(?:\/>|>([\d,]*)<\/[^>]+>)/g;
var lastLength = void 0;
do {
lastLength = nodes.length;
data = data.replace(regex, function (all, name, attrs, data) {
var length = nodes.length;
var node = new SimpleDOMNode(name);
var children = [];
if (data) {
data = data.split(',');
data.pop();
data.forEach(function (child) {
var childNode = nodes[+child];
childNode.parentNode = node;
children.push(childNode);
});
}
node.childNodes = children;
nodes.push(node);
return length + ',';
});
} while (lastLength < nodes.length);
return { documentElement: nodes.pop() };
}
}, {
key: '_decodeXML',
value: function _decodeXML(text) {
if (!text.includes('&')) {
return text;
}
return text.replace(/&(#(x[0-9a-f]+|\d+)|\w+);/gi, function (all, entityName, number) {
if (number) {
if (number[0] === 'x') {
number = parseInt(number.substring(1), 16);
} else {
number = +number;
}
return String.fromCharCode(number);
}
switch (entityName) {
case 'amp':
return '&';
case 'lt':
return '<';
case 'gt':
return '>';
case 'quot':
return '\"';
case 'apos':
return '\'';
}
return '&' + entityName + ';';
});
}
}]);
return SimpleXMLParser;
}();
var RenderingCancelledException = function RenderingCancelledException() {

@@ -440,4 +310,3 @@ function RenderingCancelledException(msg, type) {

exports.DOMSVGFactory = DOMSVGFactory;
exports.SimpleXMLParser = SimpleXMLParser;
exports.StatTimer = StatTimer;
exports.DummyStatTimer = DummyStatTimer;

@@ -33,3 +33,3 @@ /**

var _dom_utils = require('./dom_utils');
var _xml_parser = require('./xml_parser');

@@ -44,6 +44,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

data = this._repair(data);
var parser = new _dom_utils.SimpleXMLParser();
data = parser.parseFromString(data);
var parser = new _xml_parser.SimpleXMLParser();
var xmlDocument = parser.parseFromString(data);
this._metadata = Object.create(null);
this._parse(data);
if (xmlDocument) {
this._parse(xmlDocument);
}
}

@@ -86,4 +88,4 @@

key: '_parse',
value: function _parse(domDocument) {
var rdf = domDocument.documentElement;
value: function _parse(xmlDocument) {
var rdf = xmlDocument.documentElement;
if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') {

@@ -90,0 +92,0 @@ rdf = rdf.firstChild;

@@ -24,4 +24,4 @@ /**

var pdfjsVersion = '2.0.449';
var pdfjsBuild = 'b67f117b';
var pdfjsVersion = '2.0.451';
var pdfjsBuild = '24f766b1';
var pdfjsSharedUtil = require('./shared/util.js');

@@ -28,0 +28,0 @@ var pdfjsDisplayAPI = require('./display/api.js');

@@ -24,5 +24,5 @@ /**

var pdfjsVersion = '2.0.449';
var pdfjsBuild = 'b67f117b';
var pdfjsVersion = '2.0.451';
var pdfjsBuild = '24f766b1';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

@@ -51,4 +51,4 @@ /**

var pdfjsVersion = '2.0.449';
var pdfjsBuild = 'b67f117b';
var pdfjsVersion = '2.0.451';
var pdfjsBuild = '24f766b1';
exports.PDFViewer = _pdf_viewer.PDFViewer;

@@ -55,0 +55,0 @@ exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer;

{
"name": "pdfjs-dist",
"version": "2.0.449",
"version": "2.0.451",
"main": "build/pdf.js",

@@ -5,0 +5,0 @@ "description": "Generic build of Mozilla's PDF.js library.",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc