diff --git a/bower.json b/bower.json index a68cf6280..8d9018b00 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.5.454", + "version": "1.5.456", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index bfee8a084..979572d47 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.454'; -var pdfjsBuild = '03588cc'; +var pdfjsVersion = '1.5.456'; +var pdfjsBuild = '4d15928'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -2717,8 +2717,6 @@ function loadJpegStream(id, imageUrl, objs) { /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ (function checkURLConstructor(scope) { - /* jshint ignore:start */ - // feature detect for URL constructor var hasWorkingUrl = false; try { @@ -2731,8 +2729,9 @@ function loadJpegStream(id, imageUrl, objs) { } } catch(e) { } - if (hasWorkingUrl) + if (hasWorkingUrl) { return; + } var relative = Object.create(null); relative['ftp'] = 21; @@ -2759,11 +2758,11 @@ function loadJpegStream(id, imageUrl, objs) { } function IDNAToASCII(h) { - if ('' == h) { - invalid.call(this) + if ('' === h) { + invalid.call(this); } // XXX - return h.toLowerCase() + return h.toLowerCase(); } function percentEscape(c) { @@ -2771,7 +2770,7 @@ function loadJpegStream(id, imageUrl, objs) { if (unicode > 0x20 && unicode < 0x7F && // " # < > ? ` - [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1 + [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1 ) { return c; } @@ -2786,20 +2785,19 @@ function loadJpegStream(id, imageUrl, objs) { if (unicode > 0x20 && unicode < 0x7F && // " # < > ` (do not escape '?') - [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1 + [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1 ) { return c; } return encodeURIComponent(c); } - var EOF = undefined, - ALPHA = /[a-zA-Z]/, + var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/; function parse(input, stateOverride, base) { function err(message) { - errors.push(message) + errors.push(message); } var state = stateOverride || 'scheme start', @@ -2809,7 +2807,8 @@ function loadJpegStream(id, imageUrl, objs) { seenBracket = false, errors = []; - loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) { + loop: while ((input[cursor - 1] !== EOF || cursor === 0) && + !this._isInvalid) { var c = input[cursor]; switch (state) { case 'scheme start': @@ -2829,7 +2828,7 @@ function loadJpegStream(id, imageUrl, objs) { case 'scheme': if (c && ALPHANUMERIC.test(c)) { buffer += c.toLowerCase(); // ASCII-safe - } else if (':' == c) { + } else if (':' === c) { this._scheme = buffer; buffer = ''; if (stateOverride) { @@ -2838,9 +2837,10 @@ function loadJpegStream(id, imageUrl, objs) { if (isRelativeScheme(this._scheme)) { this._isRelative = true; } - if ('file' == this._scheme) { + if ('file' === this._scheme) { state = 'relative'; - } else if (this._isRelative && base && base._scheme == this._scheme) { + } else if (this._isRelative && base && + base._scheme === this._scheme) { state = 'relative or authority'; } else if (this._isRelative) { state = 'authority first slash'; @@ -2852,24 +2852,24 @@ function loadJpegStream(id, imageUrl, objs) { cursor = 0; state = 'no scheme'; continue; - } else if (EOF == c) { + } else if (EOF === c) { break loop; } else { - err('Code point not allowed in scheme: ' + c) + err('Code point not allowed in scheme: ' + c); break loop; } break; case 'scheme data': - if ('?' == c) { + if ('?' === c) { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._fragment = '#'; state = 'fragment'; } else { // XXX error handling - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._schemeData += percentEscape(c); } } @@ -2886,20 +2886,21 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative or authority': - if ('/' == c && '/' == input[cursor+1]) { + if ('/' === c && '/' === input[cursor+1]) { state = 'authority ignore slashes'; } else { err('Expected /, got: ' + c); state = 'relative'; - continue + continue; } break; case 'relative': this._isRelative = true; - if ('file' != this._scheme) + if ('file' !== this._scheme) { this._scheme = base._scheme; - if (EOF == c) { + } + if (EOF === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2907,11 +2908,12 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; break loop; - } else if ('/' == c || '\\' == c) { - if ('\\' == c) + } else if ('/' === c || '\\' === c) { + if ('\\' === c) { err('\\ is an invalid code point.'); + } state = 'relative slash'; - } else if ('?' == c) { + } else if ('?' === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2919,7 +2921,7 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2929,12 +2931,12 @@ function loadJpegStream(id, imageUrl, objs) { this._password = base._password; state = 'fragment'; } else { - var nextC = input[cursor+1] - var nextNextC = input[cursor+2] - if ( - 'file' != this._scheme || !ALPHA.test(c) || - (nextC != ':' && nextC != '|') || - (EOF != nextNextC && '/' != nextNextC && '\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) { + var nextC = input[cursor+1]; + var nextNextC = input[cursor+2]; + if ('file' !== this._scheme || !ALPHA.test(c) || + (nextC !== ':' && nextC !== '|') || + (EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && + '?' !== nextNextC && '#' !== nextNextC)) { this._host = base._host; this._port = base._port; this._username = base._username; @@ -2948,17 +2950,17 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative slash': - if ('/' == c || '\\' == c) { - if ('\\' == c) { + if ('/' === c || '\\' === c) { + if ('\\' === c) { err('\\ is an invalid code point.'); } - if ('file' == this._scheme) { + if ('file' === this._scheme) { state = 'file host'; } else { state = 'authority ignore slashes'; } } else { - if ('file' != this._scheme) { + if ('file' !== this._scheme) { this._host = base._host; this._port = base._port; this._username = base._username; @@ -2970,10 +2972,10 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'authority first slash': - if ('/' == c) { + if ('/' === c) { state = 'authority second slash'; } else { - err("Expected '/', got: " + c); + err('Expected \'/\', got: ' + c); state = 'authority ignore slashes'; continue; } @@ -2981,14 +2983,14 @@ function loadJpegStream(id, imageUrl, objs) { case 'authority second slash': state = 'authority ignore slashes'; - if ('/' != c) { - err("Expected '/', got: " + c); + if ('/' !== c) { + err('Expected \'/\', got: ' + c); continue; } break; case 'authority ignore slashes': - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { state = 'authority'; continue; } else { @@ -2997,7 +2999,7 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'authority': - if ('@' == c) { + if ('@' === c) { if (seenAt) { err('@ already seen.'); buffer += '%40'; @@ -3005,20 +3007,25 @@ function loadJpegStream(id, imageUrl, objs) { seenAt = true; for (var i = 0; i < buffer.length; i++) { var cp = buffer[i]; - if ('\t' == cp || '\n' == cp || '\r' == cp) { + if ('\t' === cp || '\n' === cp || '\r' === cp) { err('Invalid whitespace in authority.'); continue; } // XXX check URL code points - if (':' == cp && null === this._password) { + if (':' === cp && null === this._password) { this._password = ''; continue; } var tempC = percentEscape(cp); - (null !== this._password) ? this._password += tempC : this._username += tempC; + if (null !== this._password) { + this._password += tempC; + } else { + this._username += tempC; + } } buffer = ''; - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } else if (EOF === c || '/' === c || '\\' === c || + '?' === c || '#' === c) { cursor -= buffer.length; buffer = ''; state = 'host'; @@ -3029,10 +3036,11 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'file host': - if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { - if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) { + if (EOF === c || '/' === c || '\\' === c || '?' === c || '#' === c) { + if (buffer.length === 2 && ALPHA.test(buffer[0]) && + (buffer[1] === ':' || buffer[1] === '|')) { state = 'relative path'; - } else if (buffer.length == 0) { + } else if (buffer.length === 0) { state = 'relative path start'; } else { this._host = IDNAToASCII.call(this, buffer); @@ -3040,7 +3048,7 @@ function loadJpegStream(id, imageUrl, objs) { state = 'relative path start'; } continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } else if ('\t' === c || '\n' === c || '\r' === c) { err('Invalid whitespace in file host.'); } else { buffer += c; @@ -3049,15 +3057,16 @@ function loadJpegStream(id, imageUrl, objs) { case 'host': case 'hostname': - if (':' == c && !seenBracket) { + if (':' === c && !seenBracket) { // XXX host parsing this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'port'; - if ('hostname' == stateOverride) { + if ('hostname' === stateOverride) { break loop; } - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } else if (EOF === c || '/' === c || + '\\' === c || '?' === c || '#' === c) { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'relative path start'; @@ -3065,10 +3074,10 @@ function loadJpegStream(id, imageUrl, objs) { break loop; } continue; - } else if ('\t' != c && '\n' != c && '\r' != c) { - if ('[' == c) { + } else if ('\t' !== c && '\n' !== c && '\r' !== c) { + if ('[' === c) { seenBracket = true; - } else if (']' == c) { + } else if (']' === c) { seenBracket = false; } buffer += c; @@ -3080,10 +3089,11 @@ function loadJpegStream(id, imageUrl, objs) { case 'port': if (/[0-9]/.test(c)) { buffer += c; - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c || stateOverride) { - if ('' != buffer) { + } else if (EOF === c || '/' === c || '\\' === c || + '?' === c || '#' === c || stateOverride) { + if ('' !== buffer) { var temp = parseInt(buffer, 10); - if (temp != relative[this._scheme]) { + if (temp !== relative[this._scheme]) { this._port = temp + ''; } buffer = ''; @@ -3093,7 +3103,7 @@ function loadJpegStream(id, imageUrl, objs) { } state = 'relative path start'; continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } else if ('\t' === c || '\n' === c || '\r' === c) { err('Invalid code point in port: ' + c); } else { invalid.call(this); @@ -3101,60 +3111,64 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative path start': - if ('\\' == c) - err("'\\' not allowed in path."); + if ('\\' === c) { + err('\'\\\' not allowed in path.'); + } state = 'relative path'; - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { continue; } break; case 'relative path': - if (EOF == c || '/' == c || '\\' == c || (!stateOverride && ('?' == c || '#' == c))) { - if ('\\' == c) { + if (EOF === c || '/' === c || '\\' === c || + (!stateOverride && ('?' === c || '#' === c))) { + if ('\\' === c) { err('\\ not allowed in relative path.'); } var tmp; if (tmp = relativePathDotMapping[buffer.toLowerCase()]) { buffer = tmp; } - if ('..' == buffer) { + if ('..' === buffer) { this._path.pop(); - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { this._path.push(''); } - } else if ('.' == buffer && '/' != c && '\\' != c) { + } else if ('.' === buffer && '/' !== c && '\\' !== c) { this._path.push(''); - } else if ('.' != buffer) { - if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') { + } else if ('.' !== buffer) { + if ('file' === this._scheme && this._path.length === 0 && + buffer.length === 2 && ALPHA.test(buffer[0]) && + buffer[1] === '|') { buffer = buffer[0] + ':'; } this._path.push(buffer); } buffer = ''; - if ('?' == c) { + if ('?' === c) { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._fragment = '#'; state = 'fragment'; } - } else if ('\t' != c && '\n' != c && '\r' != c) { + } else if ('\t' !== c && '\n' !== c && '\r' !== c) { buffer += percentEscape(c); } break; case 'query': - if (!stateOverride && '#' == c) { + if (!stateOverride && '#' === c) { this._fragment = '#'; state = 'fragment'; - } else if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._query += percentEscapeQuery(c); } break; case 'fragment': - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._fragment += c; } break; @@ -3180,9 +3194,10 @@ function loadJpegStream(id, imageUrl, objs) { // Does not process domain names or IP addresses. // Does not handle encoding for the query parameter. - function jURL(url, base /* , encoding */) { - if (base !== undefined && !(base instanceof jURL)) - base = new jURL(String(base)); + function JURL(url, base /* , encoding */) { + if (base !== undefined && !(base instanceof JURL)) { + base = new JURL(String(base)); + } this._url = url; clear.call(this); @@ -3193,18 +3208,18 @@ function loadJpegStream(id, imageUrl, objs) { parse.call(this, input, null, base); } - jURL.prototype = { + JURL.prototype = { toString: function() { return this.href; }, get href() { - if (this._isInvalid) + if (this._isInvalid) { return this._url; - + } var authority = ''; - if ('' != this._username || null != this._password) { + if ('' !== this._username || null !== this._password) { authority = this._username + - (null != this._password ? ':' + this._password : '') + '@'; + (null !== this._password ? ':' + this._password : '') + '@'; } return this.protocol + @@ -3220,8 +3235,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._scheme + ':'; }, set protocol(protocol) { - if (this._isInvalid) + if (this._isInvalid) { return; + } parse.call(this, protocol + ':', 'scheme start'); }, @@ -3230,8 +3246,9 @@ function loadJpegStream(id, imageUrl, objs) { this._host + ':' + this._port : this._host; }, set host(host) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, host, 'host'); }, @@ -3239,8 +3256,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._host; }, set hostname(hostname) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, hostname, 'hostname'); }, @@ -3248,8 +3266,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._port; }, set port(port) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, port, 'port'); }, @@ -3258,35 +3277,40 @@ function loadJpegStream(id, imageUrl, objs) { '/' + this._path.join('/') : this._schemeData; }, set pathname(pathname) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } this._path = []; parse.call(this, pathname, 'relative path start'); }, get search() { - return this._isInvalid || !this._query || '?' == this._query ? + return this._isInvalid || !this._query || '?' === this._query ? '' : this._query; }, set search(search) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } this._query = '?'; - if ('?' == search[0]) + if ('?' === search[0]) { search = search.slice(1); + } parse.call(this, search, 'query'); }, get hash() { - return this._isInvalid || !this._fragment || '#' == this._fragment ? + return this._isInvalid || !this._fragment || '#' === this._fragment ? '' : this._fragment; }, set hash(hash) { - if (this._isInvalid) + if (this._isInvalid) { return; + } this._fragment = '#'; - if ('#' == hash[0]) + if ('#' === hash[0]) { hash = hash.slice(1); + } parse.call(this, hash, 'fragment'); }, @@ -3318,18 +3342,17 @@ function loadJpegStream(id, imageUrl, objs) { // Copy over the static methods var OriginalURL = scope.URL; if (OriginalURL) { - jURL.createObjectURL = function(blob) { + JURL.createObjectURL = function(blob) { // IE extension allows a second optional options argument. // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx return OriginalURL.createObjectURL.apply(OriginalURL, arguments); }; - jURL.revokeObjectURL = function(url) { + JURL.revokeObjectURL = function(url) { OriginalURL.revokeObjectURL(url); }; } - scope.URL = jURL; - /* jshint ignore:end */ + scope.URL = JURL; })(globalScope); exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; diff --git a/build/pdf.js b/build/pdf.js index b82243611..7a9694137 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.454'; -var pdfjsBuild = '03588cc'; +var pdfjsVersion = '1.5.456'; +var pdfjsBuild = '4d15928'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -1731,8 +1731,6 @@ function loadJpegStream(id, imageUrl, objs) { /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ (function checkURLConstructor(scope) { - /* jshint ignore:start */ - // feature detect for URL constructor var hasWorkingUrl = false; try { @@ -1745,8 +1743,9 @@ function loadJpegStream(id, imageUrl, objs) { } } catch(e) { } - if (hasWorkingUrl) + if (hasWorkingUrl) { return; + } var relative = Object.create(null); relative['ftp'] = 21; @@ -1773,11 +1772,11 @@ function loadJpegStream(id, imageUrl, objs) { } function IDNAToASCII(h) { - if ('' == h) { - invalid.call(this) + if ('' === h) { + invalid.call(this); } // XXX - return h.toLowerCase() + return h.toLowerCase(); } function percentEscape(c) { @@ -1785,7 +1784,7 @@ function loadJpegStream(id, imageUrl, objs) { if (unicode > 0x20 && unicode < 0x7F && // " # < > ? ` - [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1 + [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1 ) { return c; } @@ -1800,20 +1799,19 @@ function loadJpegStream(id, imageUrl, objs) { if (unicode > 0x20 && unicode < 0x7F && // " # < > ` (do not escape '?') - [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1 + [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1 ) { return c; } return encodeURIComponent(c); } - var EOF = undefined, - ALPHA = /[a-zA-Z]/, + var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/; function parse(input, stateOverride, base) { function err(message) { - errors.push(message) + errors.push(message); } var state = stateOverride || 'scheme start', @@ -1823,7 +1821,8 @@ function loadJpegStream(id, imageUrl, objs) { seenBracket = false, errors = []; - loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) { + loop: while ((input[cursor - 1] !== EOF || cursor === 0) && + !this._isInvalid) { var c = input[cursor]; switch (state) { case 'scheme start': @@ -1843,7 +1842,7 @@ function loadJpegStream(id, imageUrl, objs) { case 'scheme': if (c && ALPHANUMERIC.test(c)) { buffer += c.toLowerCase(); // ASCII-safe - } else if (':' == c) { + } else if (':' === c) { this._scheme = buffer; buffer = ''; if (stateOverride) { @@ -1852,9 +1851,10 @@ function loadJpegStream(id, imageUrl, objs) { if (isRelativeScheme(this._scheme)) { this._isRelative = true; } - if ('file' == this._scheme) { + if ('file' === this._scheme) { state = 'relative'; - } else if (this._isRelative && base && base._scheme == this._scheme) { + } else if (this._isRelative && base && + base._scheme === this._scheme) { state = 'relative or authority'; } else if (this._isRelative) { state = 'authority first slash'; @@ -1866,24 +1866,24 @@ function loadJpegStream(id, imageUrl, objs) { cursor = 0; state = 'no scheme'; continue; - } else if (EOF == c) { + } else if (EOF === c) { break loop; } else { - err('Code point not allowed in scheme: ' + c) + err('Code point not allowed in scheme: ' + c); break loop; } break; case 'scheme data': - if ('?' == c) { + if ('?' === c) { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._fragment = '#'; state = 'fragment'; } else { // XXX error handling - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._schemeData += percentEscape(c); } } @@ -1900,20 +1900,21 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative or authority': - if ('/' == c && '/' == input[cursor+1]) { + if ('/' === c && '/' === input[cursor+1]) { state = 'authority ignore slashes'; } else { err('Expected /, got: ' + c); state = 'relative'; - continue + continue; } break; case 'relative': this._isRelative = true; - if ('file' != this._scheme) + if ('file' !== this._scheme) { this._scheme = base._scheme; - if (EOF == c) { + } + if (EOF === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -1921,11 +1922,12 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; break loop; - } else if ('/' == c || '\\' == c) { - if ('\\' == c) + } else if ('/' === c || '\\' === c) { + if ('\\' === c) { err('\\ is an invalid code point.'); + } state = 'relative slash'; - } else if ('?' == c) { + } else if ('?' === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -1933,7 +1935,7 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -1943,12 +1945,12 @@ function loadJpegStream(id, imageUrl, objs) { this._password = base._password; state = 'fragment'; } else { - var nextC = input[cursor+1] - var nextNextC = input[cursor+2] - if ( - 'file' != this._scheme || !ALPHA.test(c) || - (nextC != ':' && nextC != '|') || - (EOF != nextNextC && '/' != nextNextC && '\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) { + var nextC = input[cursor+1]; + var nextNextC = input[cursor+2]; + if ('file' !== this._scheme || !ALPHA.test(c) || + (nextC !== ':' && nextC !== '|') || + (EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && + '?' !== nextNextC && '#' !== nextNextC)) { this._host = base._host; this._port = base._port; this._username = base._username; @@ -1962,17 +1964,17 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative slash': - if ('/' == c || '\\' == c) { - if ('\\' == c) { + if ('/' === c || '\\' === c) { + if ('\\' === c) { err('\\ is an invalid code point.'); } - if ('file' == this._scheme) { + if ('file' === this._scheme) { state = 'file host'; } else { state = 'authority ignore slashes'; } } else { - if ('file' != this._scheme) { + if ('file' !== this._scheme) { this._host = base._host; this._port = base._port; this._username = base._username; @@ -1984,10 +1986,10 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'authority first slash': - if ('/' == c) { + if ('/' === c) { state = 'authority second slash'; } else { - err("Expected '/', got: " + c); + err('Expected \'/\', got: ' + c); state = 'authority ignore slashes'; continue; } @@ -1995,14 +1997,14 @@ function loadJpegStream(id, imageUrl, objs) { case 'authority second slash': state = 'authority ignore slashes'; - if ('/' != c) { - err("Expected '/', got: " + c); + if ('/' !== c) { + err('Expected \'/\', got: ' + c); continue; } break; case 'authority ignore slashes': - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { state = 'authority'; continue; } else { @@ -2011,7 +2013,7 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'authority': - if ('@' == c) { + if ('@' === c) { if (seenAt) { err('@ already seen.'); buffer += '%40'; @@ -2019,20 +2021,25 @@ function loadJpegStream(id, imageUrl, objs) { seenAt = true; for (var i = 0; i < buffer.length; i++) { var cp = buffer[i]; - if ('\t' == cp || '\n' == cp || '\r' == cp) { + if ('\t' === cp || '\n' === cp || '\r' === cp) { err('Invalid whitespace in authority.'); continue; } // XXX check URL code points - if (':' == cp && null === this._password) { + if (':' === cp && null === this._password) { this._password = ''; continue; } var tempC = percentEscape(cp); - (null !== this._password) ? this._password += tempC : this._username += tempC; + if (null !== this._password) { + this._password += tempC; + } else { + this._username += tempC; + } } buffer = ''; - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } else if (EOF === c || '/' === c || '\\' === c || + '?' === c || '#' === c) { cursor -= buffer.length; buffer = ''; state = 'host'; @@ -2043,10 +2050,11 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'file host': - if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { - if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) { + if (EOF === c || '/' === c || '\\' === c || '?' === c || '#' === c) { + if (buffer.length === 2 && ALPHA.test(buffer[0]) && + (buffer[1] === ':' || buffer[1] === '|')) { state = 'relative path'; - } else if (buffer.length == 0) { + } else if (buffer.length === 0) { state = 'relative path start'; } else { this._host = IDNAToASCII.call(this, buffer); @@ -2054,7 +2062,7 @@ function loadJpegStream(id, imageUrl, objs) { state = 'relative path start'; } continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } else if ('\t' === c || '\n' === c || '\r' === c) { err('Invalid whitespace in file host.'); } else { buffer += c; @@ -2063,15 +2071,16 @@ function loadJpegStream(id, imageUrl, objs) { case 'host': case 'hostname': - if (':' == c && !seenBracket) { + if (':' === c && !seenBracket) { // XXX host parsing this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'port'; - if ('hostname' == stateOverride) { + if ('hostname' === stateOverride) { break loop; } - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } else if (EOF === c || '/' === c || + '\\' === c || '?' === c || '#' === c) { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'relative path start'; @@ -2079,10 +2088,10 @@ function loadJpegStream(id, imageUrl, objs) { break loop; } continue; - } else if ('\t' != c && '\n' != c && '\r' != c) { - if ('[' == c) { + } else if ('\t' !== c && '\n' !== c && '\r' !== c) { + if ('[' === c) { seenBracket = true; - } else if (']' == c) { + } else if (']' === c) { seenBracket = false; } buffer += c; @@ -2094,10 +2103,11 @@ function loadJpegStream(id, imageUrl, objs) { case 'port': if (/[0-9]/.test(c)) { buffer += c; - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c || stateOverride) { - if ('' != buffer) { + } else if (EOF === c || '/' === c || '\\' === c || + '?' === c || '#' === c || stateOverride) { + if ('' !== buffer) { var temp = parseInt(buffer, 10); - if (temp != relative[this._scheme]) { + if (temp !== relative[this._scheme]) { this._port = temp + ''; } buffer = ''; @@ -2107,7 +2117,7 @@ function loadJpegStream(id, imageUrl, objs) { } state = 'relative path start'; continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } else if ('\t' === c || '\n' === c || '\r' === c) { err('Invalid code point in port: ' + c); } else { invalid.call(this); @@ -2115,60 +2125,64 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative path start': - if ('\\' == c) - err("'\\' not allowed in path."); + if ('\\' === c) { + err('\'\\\' not allowed in path.'); + } state = 'relative path'; - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { continue; } break; case 'relative path': - if (EOF == c || '/' == c || '\\' == c || (!stateOverride && ('?' == c || '#' == c))) { - if ('\\' == c) { + if (EOF === c || '/' === c || '\\' === c || + (!stateOverride && ('?' === c || '#' === c))) { + if ('\\' === c) { err('\\ not allowed in relative path.'); } var tmp; if (tmp = relativePathDotMapping[buffer.toLowerCase()]) { buffer = tmp; } - if ('..' == buffer) { + if ('..' === buffer) { this._path.pop(); - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { this._path.push(''); } - } else if ('.' == buffer && '/' != c && '\\' != c) { + } else if ('.' === buffer && '/' !== c && '\\' !== c) { this._path.push(''); - } else if ('.' != buffer) { - if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') { + } else if ('.' !== buffer) { + if ('file' === this._scheme && this._path.length === 0 && + buffer.length === 2 && ALPHA.test(buffer[0]) && + buffer[1] === '|') { buffer = buffer[0] + ':'; } this._path.push(buffer); } buffer = ''; - if ('?' == c) { + if ('?' === c) { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._fragment = '#'; state = 'fragment'; } - } else if ('\t' != c && '\n' != c && '\r' != c) { + } else if ('\t' !== c && '\n' !== c && '\r' !== c) { buffer += percentEscape(c); } break; case 'query': - if (!stateOverride && '#' == c) { + if (!stateOverride && '#' === c) { this._fragment = '#'; state = 'fragment'; - } else if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._query += percentEscapeQuery(c); } break; case 'fragment': - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._fragment += c; } break; @@ -2194,9 +2208,10 @@ function loadJpegStream(id, imageUrl, objs) { // Does not process domain names or IP addresses. // Does not handle encoding for the query parameter. - function jURL(url, base /* , encoding */) { - if (base !== undefined && !(base instanceof jURL)) - base = new jURL(String(base)); + function JURL(url, base /* , encoding */) { + if (base !== undefined && !(base instanceof JURL)) { + base = new JURL(String(base)); + } this._url = url; clear.call(this); @@ -2207,18 +2222,18 @@ function loadJpegStream(id, imageUrl, objs) { parse.call(this, input, null, base); } - jURL.prototype = { + JURL.prototype = { toString: function() { return this.href; }, get href() { - if (this._isInvalid) + if (this._isInvalid) { return this._url; - + } var authority = ''; - if ('' != this._username || null != this._password) { + if ('' !== this._username || null !== this._password) { authority = this._username + - (null != this._password ? ':' + this._password : '') + '@'; + (null !== this._password ? ':' + this._password : '') + '@'; } return this.protocol + @@ -2234,8 +2249,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._scheme + ':'; }, set protocol(protocol) { - if (this._isInvalid) + if (this._isInvalid) { return; + } parse.call(this, protocol + ':', 'scheme start'); }, @@ -2244,8 +2260,9 @@ function loadJpegStream(id, imageUrl, objs) { this._host + ':' + this._port : this._host; }, set host(host) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, host, 'host'); }, @@ -2253,8 +2270,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._host; }, set hostname(hostname) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, hostname, 'hostname'); }, @@ -2262,8 +2280,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._port; }, set port(port) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, port, 'port'); }, @@ -2272,35 +2291,40 @@ function loadJpegStream(id, imageUrl, objs) { '/' + this._path.join('/') : this._schemeData; }, set pathname(pathname) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } this._path = []; parse.call(this, pathname, 'relative path start'); }, get search() { - return this._isInvalid || !this._query || '?' == this._query ? + return this._isInvalid || !this._query || '?' === this._query ? '' : this._query; }, set search(search) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } this._query = '?'; - if ('?' == search[0]) + if ('?' === search[0]) { search = search.slice(1); + } parse.call(this, search, 'query'); }, get hash() { - return this._isInvalid || !this._fragment || '#' == this._fragment ? + return this._isInvalid || !this._fragment || '#' === this._fragment ? '' : this._fragment; }, set hash(hash) { - if (this._isInvalid) + if (this._isInvalid) { return; + } this._fragment = '#'; - if ('#' == hash[0]) + if ('#' === hash[0]) { hash = hash.slice(1); + } parse.call(this, hash, 'fragment'); }, @@ -2332,18 +2356,17 @@ function loadJpegStream(id, imageUrl, objs) { // Copy over the static methods var OriginalURL = scope.URL; if (OriginalURL) { - jURL.createObjectURL = function(blob) { + JURL.createObjectURL = function(blob) { // IE extension allows a second optional options argument. // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx return OriginalURL.createObjectURL.apply(OriginalURL, arguments); }; - jURL.revokeObjectURL = function(url) { + JURL.revokeObjectURL = function(url) { OriginalURL.revokeObjectURL(url); }; } - scope.URL = jURL; - /* jshint ignore:end */ + scope.URL = JURL; })(globalScope); exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; diff --git a/build/pdf.worker.js b/build/pdf.worker.js index e1d8c624e..ee36ff66d 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.454'; -var pdfjsBuild = '03588cc'; +var pdfjsVersion = '1.5.456'; +var pdfjsBuild = '4d15928'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -2717,8 +2717,6 @@ function loadJpegStream(id, imageUrl, objs) { /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ (function checkURLConstructor(scope) { - /* jshint ignore:start */ - // feature detect for URL constructor var hasWorkingUrl = false; try { @@ -2731,8 +2729,9 @@ function loadJpegStream(id, imageUrl, objs) { } } catch(e) { } - if (hasWorkingUrl) + if (hasWorkingUrl) { return; + } var relative = Object.create(null); relative['ftp'] = 21; @@ -2759,11 +2758,11 @@ function loadJpegStream(id, imageUrl, objs) { } function IDNAToASCII(h) { - if ('' == h) { - invalid.call(this) + if ('' === h) { + invalid.call(this); } // XXX - return h.toLowerCase() + return h.toLowerCase(); } function percentEscape(c) { @@ -2771,7 +2770,7 @@ function loadJpegStream(id, imageUrl, objs) { if (unicode > 0x20 && unicode < 0x7F && // " # < > ? ` - [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1 + [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1 ) { return c; } @@ -2786,20 +2785,19 @@ function loadJpegStream(id, imageUrl, objs) { if (unicode > 0x20 && unicode < 0x7F && // " # < > ` (do not escape '?') - [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1 + [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1 ) { return c; } return encodeURIComponent(c); } - var EOF = undefined, - ALPHA = /[a-zA-Z]/, + var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/; function parse(input, stateOverride, base) { function err(message) { - errors.push(message) + errors.push(message); } var state = stateOverride || 'scheme start', @@ -2809,7 +2807,8 @@ function loadJpegStream(id, imageUrl, objs) { seenBracket = false, errors = []; - loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) { + loop: while ((input[cursor - 1] !== EOF || cursor === 0) && + !this._isInvalid) { var c = input[cursor]; switch (state) { case 'scheme start': @@ -2829,7 +2828,7 @@ function loadJpegStream(id, imageUrl, objs) { case 'scheme': if (c && ALPHANUMERIC.test(c)) { buffer += c.toLowerCase(); // ASCII-safe - } else if (':' == c) { + } else if (':' === c) { this._scheme = buffer; buffer = ''; if (stateOverride) { @@ -2838,9 +2837,10 @@ function loadJpegStream(id, imageUrl, objs) { if (isRelativeScheme(this._scheme)) { this._isRelative = true; } - if ('file' == this._scheme) { + if ('file' === this._scheme) { state = 'relative'; - } else if (this._isRelative && base && base._scheme == this._scheme) { + } else if (this._isRelative && base && + base._scheme === this._scheme) { state = 'relative or authority'; } else if (this._isRelative) { state = 'authority first slash'; @@ -2852,24 +2852,24 @@ function loadJpegStream(id, imageUrl, objs) { cursor = 0; state = 'no scheme'; continue; - } else if (EOF == c) { + } else if (EOF === c) { break loop; } else { - err('Code point not allowed in scheme: ' + c) + err('Code point not allowed in scheme: ' + c); break loop; } break; case 'scheme data': - if ('?' == c) { + if ('?' === c) { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._fragment = '#'; state = 'fragment'; } else { // XXX error handling - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._schemeData += percentEscape(c); } } @@ -2886,20 +2886,21 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative or authority': - if ('/' == c && '/' == input[cursor+1]) { + if ('/' === c && '/' === input[cursor+1]) { state = 'authority ignore slashes'; } else { err('Expected /, got: ' + c); state = 'relative'; - continue + continue; } break; case 'relative': this._isRelative = true; - if ('file' != this._scheme) + if ('file' !== this._scheme) { this._scheme = base._scheme; - if (EOF == c) { + } + if (EOF === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2907,11 +2908,12 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; break loop; - } else if ('/' == c || '\\' == c) { - if ('\\' == c) + } else if ('/' === c || '\\' === c) { + if ('\\' === c) { err('\\ is an invalid code point.'); + } state = 'relative slash'; - } else if ('?' == c) { + } else if ('?' === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2919,7 +2921,7 @@ function loadJpegStream(id, imageUrl, objs) { this._username = base._username; this._password = base._password; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); @@ -2929,12 +2931,12 @@ function loadJpegStream(id, imageUrl, objs) { this._password = base._password; state = 'fragment'; } else { - var nextC = input[cursor+1] - var nextNextC = input[cursor+2] - if ( - 'file' != this._scheme || !ALPHA.test(c) || - (nextC != ':' && nextC != '|') || - (EOF != nextNextC && '/' != nextNextC && '\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) { + var nextC = input[cursor+1]; + var nextNextC = input[cursor+2]; + if ('file' !== this._scheme || !ALPHA.test(c) || + (nextC !== ':' && nextC !== '|') || + (EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && + '?' !== nextNextC && '#' !== nextNextC)) { this._host = base._host; this._port = base._port; this._username = base._username; @@ -2948,17 +2950,17 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative slash': - if ('/' == c || '\\' == c) { - if ('\\' == c) { + if ('/' === c || '\\' === c) { + if ('\\' === c) { err('\\ is an invalid code point.'); } - if ('file' == this._scheme) { + if ('file' === this._scheme) { state = 'file host'; } else { state = 'authority ignore slashes'; } } else { - if ('file' != this._scheme) { + if ('file' !== this._scheme) { this._host = base._host; this._port = base._port; this._username = base._username; @@ -2970,10 +2972,10 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'authority first slash': - if ('/' == c) { + if ('/' === c) { state = 'authority second slash'; } else { - err("Expected '/', got: " + c); + err('Expected \'/\', got: ' + c); state = 'authority ignore slashes'; continue; } @@ -2981,14 +2983,14 @@ function loadJpegStream(id, imageUrl, objs) { case 'authority second slash': state = 'authority ignore slashes'; - if ('/' != c) { - err("Expected '/', got: " + c); + if ('/' !== c) { + err('Expected \'/\', got: ' + c); continue; } break; case 'authority ignore slashes': - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { state = 'authority'; continue; } else { @@ -2997,7 +2999,7 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'authority': - if ('@' == c) { + if ('@' === c) { if (seenAt) { err('@ already seen.'); buffer += '%40'; @@ -3005,20 +3007,25 @@ function loadJpegStream(id, imageUrl, objs) { seenAt = true; for (var i = 0; i < buffer.length; i++) { var cp = buffer[i]; - if ('\t' == cp || '\n' == cp || '\r' == cp) { + if ('\t' === cp || '\n' === cp || '\r' === cp) { err('Invalid whitespace in authority.'); continue; } // XXX check URL code points - if (':' == cp && null === this._password) { + if (':' === cp && null === this._password) { this._password = ''; continue; } var tempC = percentEscape(cp); - (null !== this._password) ? this._password += tempC : this._username += tempC; + if (null !== this._password) { + this._password += tempC; + } else { + this._username += tempC; + } } buffer = ''; - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } else if (EOF === c || '/' === c || '\\' === c || + '?' === c || '#' === c) { cursor -= buffer.length; buffer = ''; state = 'host'; @@ -3029,10 +3036,11 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'file host': - if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { - if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) { + if (EOF === c || '/' === c || '\\' === c || '?' === c || '#' === c) { + if (buffer.length === 2 && ALPHA.test(buffer[0]) && + (buffer[1] === ':' || buffer[1] === '|')) { state = 'relative path'; - } else if (buffer.length == 0) { + } else if (buffer.length === 0) { state = 'relative path start'; } else { this._host = IDNAToASCII.call(this, buffer); @@ -3040,7 +3048,7 @@ function loadJpegStream(id, imageUrl, objs) { state = 'relative path start'; } continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } else if ('\t' === c || '\n' === c || '\r' === c) { err('Invalid whitespace in file host.'); } else { buffer += c; @@ -3049,15 +3057,16 @@ function loadJpegStream(id, imageUrl, objs) { case 'host': case 'hostname': - if (':' == c && !seenBracket) { + if (':' === c && !seenBracket) { // XXX host parsing this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'port'; - if ('hostname' == stateOverride) { + if ('hostname' === stateOverride) { break loop; } - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) { + } else if (EOF === c || '/' === c || + '\\' === c || '?' === c || '#' === c) { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'relative path start'; @@ -3065,10 +3074,10 @@ function loadJpegStream(id, imageUrl, objs) { break loop; } continue; - } else if ('\t' != c && '\n' != c && '\r' != c) { - if ('[' == c) { + } else if ('\t' !== c && '\n' !== c && '\r' !== c) { + if ('[' === c) { seenBracket = true; - } else if (']' == c) { + } else if (']' === c) { seenBracket = false; } buffer += c; @@ -3080,10 +3089,11 @@ function loadJpegStream(id, imageUrl, objs) { case 'port': if (/[0-9]/.test(c)) { buffer += c; - } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c || stateOverride) { - if ('' != buffer) { + } else if (EOF === c || '/' === c || '\\' === c || + '?' === c || '#' === c || stateOverride) { + if ('' !== buffer) { var temp = parseInt(buffer, 10); - if (temp != relative[this._scheme]) { + if (temp !== relative[this._scheme]) { this._port = temp + ''; } buffer = ''; @@ -3093,7 +3103,7 @@ function loadJpegStream(id, imageUrl, objs) { } state = 'relative path start'; continue; - } else if ('\t' == c || '\n' == c || '\r' == c) { + } else if ('\t' === c || '\n' === c || '\r' === c) { err('Invalid code point in port: ' + c); } else { invalid.call(this); @@ -3101,60 +3111,64 @@ function loadJpegStream(id, imageUrl, objs) { break; case 'relative path start': - if ('\\' == c) - err("'\\' not allowed in path."); + if ('\\' === c) { + err('\'\\\' not allowed in path.'); + } state = 'relative path'; - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { continue; } break; case 'relative path': - if (EOF == c || '/' == c || '\\' == c || (!stateOverride && ('?' == c || '#' == c))) { - if ('\\' == c) { + if (EOF === c || '/' === c || '\\' === c || + (!stateOverride && ('?' === c || '#' === c))) { + if ('\\' === c) { err('\\ not allowed in relative path.'); } var tmp; if (tmp = relativePathDotMapping[buffer.toLowerCase()]) { buffer = tmp; } - if ('..' == buffer) { + if ('..' === buffer) { this._path.pop(); - if ('/' != c && '\\' != c) { + if ('/' !== c && '\\' !== c) { this._path.push(''); } - } else if ('.' == buffer && '/' != c && '\\' != c) { + } else if ('.' === buffer && '/' !== c && '\\' !== c) { this._path.push(''); - } else if ('.' != buffer) { - if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') { + } else if ('.' !== buffer) { + if ('file' === this._scheme && this._path.length === 0 && + buffer.length === 2 && ALPHA.test(buffer[0]) && + buffer[1] === '|') { buffer = buffer[0] + ':'; } this._path.push(buffer); } buffer = ''; - if ('?' == c) { + if ('?' === c) { this._query = '?'; state = 'query'; - } else if ('#' == c) { + } else if ('#' === c) { this._fragment = '#'; state = 'fragment'; } - } else if ('\t' != c && '\n' != c && '\r' != c) { + } else if ('\t' !== c && '\n' !== c && '\r' !== c) { buffer += percentEscape(c); } break; case 'query': - if (!stateOverride && '#' == c) { + if (!stateOverride && '#' === c) { this._fragment = '#'; state = 'fragment'; - } else if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + } else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._query += percentEscapeQuery(c); } break; case 'fragment': - if (EOF != c && '\t' != c && '\n' != c && '\r' != c) { + if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { this._fragment += c; } break; @@ -3180,9 +3194,10 @@ function loadJpegStream(id, imageUrl, objs) { // Does not process domain names or IP addresses. // Does not handle encoding for the query parameter. - function jURL(url, base /* , encoding */) { - if (base !== undefined && !(base instanceof jURL)) - base = new jURL(String(base)); + function JURL(url, base /* , encoding */) { + if (base !== undefined && !(base instanceof JURL)) { + base = new JURL(String(base)); + } this._url = url; clear.call(this); @@ -3193,18 +3208,18 @@ function loadJpegStream(id, imageUrl, objs) { parse.call(this, input, null, base); } - jURL.prototype = { + JURL.prototype = { toString: function() { return this.href; }, get href() { - if (this._isInvalid) + if (this._isInvalid) { return this._url; - + } var authority = ''; - if ('' != this._username || null != this._password) { + if ('' !== this._username || null !== this._password) { authority = this._username + - (null != this._password ? ':' + this._password : '') + '@'; + (null !== this._password ? ':' + this._password : '') + '@'; } return this.protocol + @@ -3220,8 +3235,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._scheme + ':'; }, set protocol(protocol) { - if (this._isInvalid) + if (this._isInvalid) { return; + } parse.call(this, protocol + ':', 'scheme start'); }, @@ -3230,8 +3246,9 @@ function loadJpegStream(id, imageUrl, objs) { this._host + ':' + this._port : this._host; }, set host(host) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, host, 'host'); }, @@ -3239,8 +3256,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._host; }, set hostname(hostname) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, hostname, 'hostname'); }, @@ -3248,8 +3266,9 @@ function loadJpegStream(id, imageUrl, objs) { return this._port; }, set port(port) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } parse.call(this, port, 'port'); }, @@ -3258,35 +3277,40 @@ function loadJpegStream(id, imageUrl, objs) { '/' + this._path.join('/') : this._schemeData; }, set pathname(pathname) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } this._path = []; parse.call(this, pathname, 'relative path start'); }, get search() { - return this._isInvalid || !this._query || '?' == this._query ? + return this._isInvalid || !this._query || '?' === this._query ? '' : this._query; }, set search(search) { - if (this._isInvalid || !this._isRelative) + if (this._isInvalid || !this._isRelative) { return; + } this._query = '?'; - if ('?' == search[0]) + if ('?' === search[0]) { search = search.slice(1); + } parse.call(this, search, 'query'); }, get hash() { - return this._isInvalid || !this._fragment || '#' == this._fragment ? + return this._isInvalid || !this._fragment || '#' === this._fragment ? '' : this._fragment; }, set hash(hash) { - if (this._isInvalid) + if (this._isInvalid) { return; + } this._fragment = '#'; - if ('#' == hash[0]) + if ('#' === hash[0]) { hash = hash.slice(1); + } parse.call(this, hash, 'fragment'); }, @@ -3318,18 +3342,17 @@ function loadJpegStream(id, imageUrl, objs) { // Copy over the static methods var OriginalURL = scope.URL; if (OriginalURL) { - jURL.createObjectURL = function(blob) { + JURL.createObjectURL = function(blob) { // IE extension allows a second optional options argument. // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx return OriginalURL.createObjectURL.apply(OriginalURL, arguments); }; - jURL.revokeObjectURL = function(url) { + JURL.revokeObjectURL = function(url) { OriginalURL.revokeObjectURL(url); }; } - scope.URL = jURL; - /* jshint ignore:end */ + scope.URL = JURL; })(globalScope); exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; diff --git a/package.json b/package.json index 27df31544..76021ceb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.5.454", + "version": "1.5.456", "main": "build/pdf.js", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [