|
@@ -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.5.454';
|
|
|
|
-var pdfjsBuild = '03588cc';
|
|
|
|
|
|
+var pdfjsVersion = '1.5.456';
|
|
|
|
+var pdfjsBuild = '4d15928';
|
|
|
|
|
|
var pdfjsFilePath =
|
|
var pdfjsFilePath =
|
|
typeof document !== 'undefined' && document.currentScript ?
|
|
typeof document !== 'undefined' && document.currentScript ?
|
|
@@ -2717,8 +2717,6 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
(function checkURLConstructor(scope) {
|
|
(function checkURLConstructor(scope) {
|
|
- /* jshint ignore:start */
|
|
|
|
-
|
|
|
|
// feature detect for URL constructor
|
|
// feature detect for URL constructor
|
|
var hasWorkingUrl = false;
|
|
var hasWorkingUrl = false;
|
|
try {
|
|
try {
|
|
@@ -2731,8 +2729,9 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
}
|
|
}
|
|
} catch(e) { }
|
|
} catch(e) { }
|
|
|
|
|
|
- if (hasWorkingUrl)
|
|
|
|
|
|
+ if (hasWorkingUrl) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
|
|
|
|
var relative = Object.create(null);
|
|
var relative = Object.create(null);
|
|
relative['ftp'] = 21;
|
|
relative['ftp'] = 21;
|
|
@@ -2759,11 +2758,11 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
}
|
|
}
|
|
|
|
|
|
function IDNAToASCII(h) {
|
|
function IDNAToASCII(h) {
|
|
- if ('' == h) {
|
|
|
|
- invalid.call(this)
|
|
|
|
|
|
+ if ('' === h) {
|
|
|
|
+ invalid.call(this);
|
|
}
|
|
}
|
|
// XXX
|
|
// XXX
|
|
- return h.toLowerCase()
|
|
|
|
|
|
+ return h.toLowerCase();
|
|
}
|
|
}
|
|
|
|
|
|
function percentEscape(c) {
|
|
function percentEscape(c) {
|
|
@@ -2771,7 +2770,7 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
if (unicode > 0x20 &&
|
|
if (unicode > 0x20 &&
|
|
unicode < 0x7F &&
|
|
unicode < 0x7F &&
|
|
// " # < > ? `
|
|
// " # < > ? `
|
|
- [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1
|
|
|
|
|
|
+ [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1
|
|
) {
|
|
) {
|
|
return c;
|
|
return c;
|
|
}
|
|
}
|
|
@@ -2786,20 +2785,19 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
if (unicode > 0x20 &&
|
|
if (unicode > 0x20 &&
|
|
unicode < 0x7F &&
|
|
unicode < 0x7F &&
|
|
// " # < > ` (do not escape '?')
|
|
// " # < > ` (do not escape '?')
|
|
- [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1
|
|
|
|
|
|
+ [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1
|
|
) {
|
|
) {
|
|
return c;
|
|
return c;
|
|
}
|
|
}
|
|
return encodeURIComponent(c);
|
|
return encodeURIComponent(c);
|
|
}
|
|
}
|
|
|
|
|
|
- var EOF = undefined,
|
|
|
|
- ALPHA = /[a-zA-Z]/,
|
|
|
|
|
|
+ var EOF, ALPHA = /[a-zA-Z]/,
|
|
ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
|
|
ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
|
|
|
|
|
|
function parse(input, stateOverride, base) {
|
|
function parse(input, stateOverride, base) {
|
|
function err(message) {
|
|
function err(message) {
|
|
- errors.push(message)
|
|
|
|
|
|
+ errors.push(message);
|
|
}
|
|
}
|
|
|
|
|
|
var state = stateOverride || 'scheme start',
|
|
var state = stateOverride || 'scheme start',
|
|
@@ -2809,7 +2807,8 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
seenBracket = false,
|
|
seenBracket = false,
|
|
errors = [];
|
|
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];
|
|
var c = input[cursor];
|
|
switch (state) {
|
|
switch (state) {
|
|
case 'scheme start':
|
|
case 'scheme start':
|
|
@@ -2829,7 +2828,7 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
case 'scheme':
|
|
case 'scheme':
|
|
if (c && ALPHANUMERIC.test(c)) {
|
|
if (c && ALPHANUMERIC.test(c)) {
|
|
buffer += c.toLowerCase(); // ASCII-safe
|
|
buffer += c.toLowerCase(); // ASCII-safe
|
|
- } else if (':' == c) {
|
|
|
|
|
|
+ } else if (':' === c) {
|
|
this._scheme = buffer;
|
|
this._scheme = buffer;
|
|
buffer = '';
|
|
buffer = '';
|
|
if (stateOverride) {
|
|
if (stateOverride) {
|
|
@@ -2838,9 +2837,10 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
if (isRelativeScheme(this._scheme)) {
|
|
if (isRelativeScheme(this._scheme)) {
|
|
this._isRelative = true;
|
|
this._isRelative = true;
|
|
}
|
|
}
|
|
- if ('file' == this._scheme) {
|
|
|
|
|
|
+ if ('file' === this._scheme) {
|
|
state = 'relative';
|
|
state = 'relative';
|
|
- } else if (this._isRelative && base && base._scheme == this._scheme) {
|
|
|
|
|
|
+ } else if (this._isRelative && base &&
|
|
|
|
+ base._scheme === this._scheme) {
|
|
state = 'relative or authority';
|
|
state = 'relative or authority';
|
|
} else if (this._isRelative) {
|
|
} else if (this._isRelative) {
|
|
state = 'authority first slash';
|
|
state = 'authority first slash';
|
|
@@ -2852,24 +2852,24 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
cursor = 0;
|
|
cursor = 0;
|
|
state = 'no scheme';
|
|
state = 'no scheme';
|
|
continue;
|
|
continue;
|
|
- } else if (EOF == c) {
|
|
|
|
|
|
+ } else if (EOF === c) {
|
|
break loop;
|
|
break loop;
|
|
} else {
|
|
} else {
|
|
- err('Code point not allowed in scheme: ' + c)
|
|
|
|
|
|
+ err('Code point not allowed in scheme: ' + c);
|
|
break loop;
|
|
break loop;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'scheme data':
|
|
case 'scheme data':
|
|
- if ('?' == c) {
|
|
|
|
|
|
+ if ('?' === c) {
|
|
this._query = '?';
|
|
this._query = '?';
|
|
state = 'query';
|
|
state = 'query';
|
|
- } else if ('#' == c) {
|
|
|
|
|
|
+ } else if ('#' === c) {
|
|
this._fragment = '#';
|
|
this._fragment = '#';
|
|
state = 'fragment';
|
|
state = 'fragment';
|
|
} else {
|
|
} else {
|
|
// XXX error handling
|
|
// 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);
|
|
this._schemeData += percentEscape(c);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2886,20 +2886,21 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'relative or authority':
|
|
case 'relative or authority':
|
|
- if ('/' == c && '/' == input[cursor+1]) {
|
|
|
|
|
|
+ if ('/' === c && '/' === input[cursor+1]) {
|
|
state = 'authority ignore slashes';
|
|
state = 'authority ignore slashes';
|
|
} else {
|
|
} else {
|
|
err('Expected /, got: ' + c);
|
|
err('Expected /, got: ' + c);
|
|
state = 'relative';
|
|
state = 'relative';
|
|
- continue
|
|
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'relative':
|
|
case 'relative':
|
|
this._isRelative = true;
|
|
this._isRelative = true;
|
|
- if ('file' != this._scheme)
|
|
|
|
|
|
+ if ('file' !== this._scheme) {
|
|
this._scheme = base._scheme;
|
|
this._scheme = base._scheme;
|
|
- if (EOF == c) {
|
|
|
|
|
|
+ }
|
|
|
|
+ if (EOF === c) {
|
|
this._host = base._host;
|
|
this._host = base._host;
|
|
this._port = base._port;
|
|
this._port = base._port;
|
|
this._path = base._path.slice();
|
|
this._path = base._path.slice();
|
|
@@ -2907,11 +2908,12 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
this._username = base._username;
|
|
this._username = base._username;
|
|
this._password = base._password;
|
|
this._password = base._password;
|
|
break loop;
|
|
break loop;
|
|
- } else if ('/' == c || '\\' == c) {
|
|
|
|
- if ('\\' == c)
|
|
|
|
|
|
+ } else if ('/' === c || '\\' === c) {
|
|
|
|
+ if ('\\' === c) {
|
|
err('\\ is an invalid code point.');
|
|
err('\\ is an invalid code point.');
|
|
|
|
+ }
|
|
state = 'relative slash';
|
|
state = 'relative slash';
|
|
- } else if ('?' == c) {
|
|
|
|
|
|
+ } else if ('?' === c) {
|
|
this._host = base._host;
|
|
this._host = base._host;
|
|
this._port = base._port;
|
|
this._port = base._port;
|
|
this._path = base._path.slice();
|
|
this._path = base._path.slice();
|
|
@@ -2919,7 +2921,7 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
this._username = base._username;
|
|
this._username = base._username;
|
|
this._password = base._password;
|
|
this._password = base._password;
|
|
state = 'query';
|
|
state = 'query';
|
|
- } else if ('#' == c) {
|
|
|
|
|
|
+ } else if ('#' === c) {
|
|
this._host = base._host;
|
|
this._host = base._host;
|
|
this._port = base._port;
|
|
this._port = base._port;
|
|
this._path = base._path.slice();
|
|
this._path = base._path.slice();
|
|
@@ -2929,12 +2931,12 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
this._password = base._password;
|
|
this._password = base._password;
|
|
state = 'fragment';
|
|
state = 'fragment';
|
|
} else {
|
|
} 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._host = base._host;
|
|
this._port = base._port;
|
|
this._port = base._port;
|
|
this._username = base._username;
|
|
this._username = base._username;
|
|
@@ -2948,17 +2950,17 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'relative slash':
|
|
case 'relative slash':
|
|
- if ('/' == c || '\\' == c) {
|
|
|
|
- if ('\\' == c) {
|
|
|
|
|
|
+ if ('/' === c || '\\' === c) {
|
|
|
|
+ if ('\\' === c) {
|
|
err('\\ is an invalid code point.');
|
|
err('\\ is an invalid code point.');
|
|
}
|
|
}
|
|
- if ('file' == this._scheme) {
|
|
|
|
|
|
+ if ('file' === this._scheme) {
|
|
state = 'file host';
|
|
state = 'file host';
|
|
} else {
|
|
} else {
|
|
state = 'authority ignore slashes';
|
|
state = 'authority ignore slashes';
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if ('file' != this._scheme) {
|
|
|
|
|
|
+ if ('file' !== this._scheme) {
|
|
this._host = base._host;
|
|
this._host = base._host;
|
|
this._port = base._port;
|
|
this._port = base._port;
|
|
this._username = base._username;
|
|
this._username = base._username;
|
|
@@ -2970,10 +2972,10 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'authority first slash':
|
|
case 'authority first slash':
|
|
- if ('/' == c) {
|
|
|
|
|
|
+ if ('/' === c) {
|
|
state = 'authority second slash';
|
|
state = 'authority second slash';
|
|
} else {
|
|
} else {
|
|
- err("Expected '/', got: " + c);
|
|
|
|
|
|
+ err('Expected \'/\', got: ' + c);
|
|
state = 'authority ignore slashes';
|
|
state = 'authority ignore slashes';
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -2981,14 +2983,14 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
|
|
|
|
case 'authority second slash':
|
|
case 'authority second slash':
|
|
state = 'authority ignore slashes';
|
|
state = 'authority ignore slashes';
|
|
- if ('/' != c) {
|
|
|
|
- err("Expected '/', got: " + c);
|
|
|
|
|
|
+ if ('/' !== c) {
|
|
|
|
+ err('Expected \'/\', got: ' + c);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'authority ignore slashes':
|
|
case 'authority ignore slashes':
|
|
- if ('/' != c && '\\' != c) {
|
|
|
|
|
|
+ if ('/' !== c && '\\' !== c) {
|
|
state = 'authority';
|
|
state = 'authority';
|
|
continue;
|
|
continue;
|
|
} else {
|
|
} else {
|
|
@@ -2997,7 +2999,7 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'authority':
|
|
case 'authority':
|
|
- if ('@' == c) {
|
|
|
|
|
|
+ if ('@' === c) {
|
|
if (seenAt) {
|
|
if (seenAt) {
|
|
err('@ already seen.');
|
|
err('@ already seen.');
|
|
buffer += '%40';
|
|
buffer += '%40';
|
|
@@ -3005,20 +3007,25 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
seenAt = true;
|
|
seenAt = true;
|
|
for (var i = 0; i < buffer.length; i++) {
|
|
for (var i = 0; i < buffer.length; i++) {
|
|
var cp = buffer[i];
|
|
var cp = buffer[i];
|
|
- if ('\t' == cp || '\n' == cp || '\r' == cp) {
|
|
|
|
|
|
+ if ('\t' === cp || '\n' === cp || '\r' === cp) {
|
|
err('Invalid whitespace in authority.');
|
|
err('Invalid whitespace in authority.');
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
// XXX check URL code points
|
|
// XXX check URL code points
|
|
- if (':' == cp && null === this._password) {
|
|
|
|
|
|
+ if (':' === cp && null === this._password) {
|
|
this._password = '';
|
|
this._password = '';
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
var tempC = percentEscape(cp);
|
|
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 = '';
|
|
buffer = '';
|
|
- } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
|
|
|
|
|
|
+ } else if (EOF === c || '/' === c || '\\' === c ||
|
|
|
|
+ '?' === c || '#' === c) {
|
|
cursor -= buffer.length;
|
|
cursor -= buffer.length;
|
|
buffer = '';
|
|
buffer = '';
|
|
state = 'host';
|
|
state = 'host';
|
|
@@ -3029,10 +3036,11 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'file host':
|
|
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';
|
|
state = 'relative path';
|
|
- } else if (buffer.length == 0) {
|
|
|
|
|
|
+ } else if (buffer.length === 0) {
|
|
state = 'relative path start';
|
|
state = 'relative path start';
|
|
} else {
|
|
} else {
|
|
this._host = IDNAToASCII.call(this, buffer);
|
|
this._host = IDNAToASCII.call(this, buffer);
|
|
@@ -3040,7 +3048,7 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
state = 'relative path start';
|
|
state = 'relative path start';
|
|
}
|
|
}
|
|
continue;
|
|
continue;
|
|
- } else if ('\t' == c || '\n' == c || '\r' == c) {
|
|
|
|
|
|
+ } else if ('\t' === c || '\n' === c || '\r' === c) {
|
|
err('Invalid whitespace in file host.');
|
|
err('Invalid whitespace in file host.');
|
|
} else {
|
|
} else {
|
|
buffer += c;
|
|
buffer += c;
|
|
@@ -3049,15 +3057,16 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
|
|
|
|
case 'host':
|
|
case 'host':
|
|
case 'hostname':
|
|
case 'hostname':
|
|
- if (':' == c && !seenBracket) {
|
|
|
|
|
|
+ if (':' === c && !seenBracket) {
|
|
// XXX host parsing
|
|
// XXX host parsing
|
|
this._host = IDNAToASCII.call(this, buffer);
|
|
this._host = IDNAToASCII.call(this, buffer);
|
|
buffer = '';
|
|
buffer = '';
|
|
state = 'port';
|
|
state = 'port';
|
|
- if ('hostname' == stateOverride) {
|
|
|
|
|
|
+ if ('hostname' === stateOverride) {
|
|
break loop;
|
|
break loop;
|
|
}
|
|
}
|
|
- } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
|
|
|
|
|
|
+ } else if (EOF === c || '/' === c ||
|
|
|
|
+ '\\' === c || '?' === c || '#' === c) {
|
|
this._host = IDNAToASCII.call(this, buffer);
|
|
this._host = IDNAToASCII.call(this, buffer);
|
|
buffer = '';
|
|
buffer = '';
|
|
state = 'relative path start';
|
|
state = 'relative path start';
|
|
@@ -3065,10 +3074,10 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
break loop;
|
|
break loop;
|
|
}
|
|
}
|
|
continue;
|
|
continue;
|
|
- } else if ('\t' != c && '\n' != c && '\r' != c) {
|
|
|
|
- if ('[' == c) {
|
|
|
|
|
|
+ } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
|
|
|
|
+ if ('[' === c) {
|
|
seenBracket = true;
|
|
seenBracket = true;
|
|
- } else if (']' == c) {
|
|
|
|
|
|
+ } else if (']' === c) {
|
|
seenBracket = false;
|
|
seenBracket = false;
|
|
}
|
|
}
|
|
buffer += c;
|
|
buffer += c;
|
|
@@ -3080,10 +3089,11 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
case 'port':
|
|
case 'port':
|
|
if (/[0-9]/.test(c)) {
|
|
if (/[0-9]/.test(c)) {
|
|
buffer += 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);
|
|
var temp = parseInt(buffer, 10);
|
|
- if (temp != relative[this._scheme]) {
|
|
|
|
|
|
+ if (temp !== relative[this._scheme]) {
|
|
this._port = temp + '';
|
|
this._port = temp + '';
|
|
}
|
|
}
|
|
buffer = '';
|
|
buffer = '';
|
|
@@ -3093,7 +3103,7 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
}
|
|
}
|
|
state = 'relative path start';
|
|
state = 'relative path start';
|
|
continue;
|
|
continue;
|
|
- } else if ('\t' == c || '\n' == c || '\r' == c) {
|
|
|
|
|
|
+ } else if ('\t' === c || '\n' === c || '\r' === c) {
|
|
err('Invalid code point in port: ' + c);
|
|
err('Invalid code point in port: ' + c);
|
|
} else {
|
|
} else {
|
|
invalid.call(this);
|
|
invalid.call(this);
|
|
@@ -3101,60 +3111,64 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'relative path start':
|
|
case 'relative path start':
|
|
- if ('\\' == c)
|
|
|
|
- err("'\\' not allowed in path.");
|
|
|
|
|
|
+ if ('\\' === c) {
|
|
|
|
+ err('\'\\\' not allowed in path.');
|
|
|
|
+ }
|
|
state = 'relative path';
|
|
state = 'relative path';
|
|
- if ('/' != c && '\\' != c) {
|
|
|
|
|
|
+ if ('/' !== c && '\\' !== c) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'relative path':
|
|
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.');
|
|
err('\\ not allowed in relative path.');
|
|
}
|
|
}
|
|
var tmp;
|
|
var tmp;
|
|
if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
|
|
if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
|
|
buffer = tmp;
|
|
buffer = tmp;
|
|
}
|
|
}
|
|
- if ('..' == buffer) {
|
|
|
|
|
|
+ if ('..' === buffer) {
|
|
this._path.pop();
|
|
this._path.pop();
|
|
- if ('/' != c && '\\' != c) {
|
|
|
|
|
|
+ if ('/' !== c && '\\' !== c) {
|
|
this._path.push('');
|
|
this._path.push('');
|
|
}
|
|
}
|
|
- } else if ('.' == buffer && '/' != c && '\\' != c) {
|
|
|
|
|
|
+ } else if ('.' === buffer && '/' !== c && '\\' !== c) {
|
|
this._path.push('');
|
|
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] + ':';
|
|
buffer = buffer[0] + ':';
|
|
}
|
|
}
|
|
this._path.push(buffer);
|
|
this._path.push(buffer);
|
|
}
|
|
}
|
|
buffer = '';
|
|
buffer = '';
|
|
- if ('?' == c) {
|
|
|
|
|
|
+ if ('?' === c) {
|
|
this._query = '?';
|
|
this._query = '?';
|
|
state = 'query';
|
|
state = 'query';
|
|
- } else if ('#' == c) {
|
|
|
|
|
|
+ } else if ('#' === c) {
|
|
this._fragment = '#';
|
|
this._fragment = '#';
|
|
state = 'fragment';
|
|
state = 'fragment';
|
|
}
|
|
}
|
|
- } else if ('\t' != c && '\n' != c && '\r' != c) {
|
|
|
|
|
|
+ } else if ('\t' !== c && '\n' !== c && '\r' !== c) {
|
|
buffer += percentEscape(c);
|
|
buffer += percentEscape(c);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'query':
|
|
case 'query':
|
|
- if (!stateOverride && '#' == c) {
|
|
|
|
|
|
+ if (!stateOverride && '#' === c) {
|
|
this._fragment = '#';
|
|
this._fragment = '#';
|
|
state = '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);
|
|
this._query += percentEscapeQuery(c);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'fragment':
|
|
case 'fragment':
|
|
- if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
|
|
|
|
|
|
+ if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) {
|
|
this._fragment += c;
|
|
this._fragment += c;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -3180,9 +3194,10 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
|
|
|
|
// Does not process domain names or IP addresses.
|
|
// Does not process domain names or IP addresses.
|
|
// Does not handle encoding for the query parameter.
|
|
// 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;
|
|
this._url = url;
|
|
clear.call(this);
|
|
clear.call(this);
|
|
@@ -3193,18 +3208,18 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
parse.call(this, input, null, base);
|
|
parse.call(this, input, null, base);
|
|
}
|
|
}
|
|
|
|
|
|
- jURL.prototype = {
|
|
|
|
|
|
+ JURL.prototype = {
|
|
toString: function() {
|
|
toString: function() {
|
|
return this.href;
|
|
return this.href;
|
|
},
|
|
},
|
|
get href() {
|
|
get href() {
|
|
- if (this._isInvalid)
|
|
|
|
|
|
+ if (this._isInvalid) {
|
|
return this._url;
|
|
return this._url;
|
|
-
|
|
|
|
|
|
+ }
|
|
var authority = '';
|
|
var authority = '';
|
|
- if ('' != this._username || null != this._password) {
|
|
|
|
|
|
+ if ('' !== this._username || null !== this._password) {
|
|
authority = this._username +
|
|
authority = this._username +
|
|
- (null != this._password ? ':' + this._password : '') + '@';
|
|
|
|
|
|
+ (null !== this._password ? ':' + this._password : '') + '@';
|
|
}
|
|
}
|
|
|
|
|
|
return this.protocol +
|
|
return this.protocol +
|
|
@@ -3220,8 +3235,9 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
return this._scheme + ':';
|
|
return this._scheme + ':';
|
|
},
|
|
},
|
|
set protocol(protocol) {
|
|
set protocol(protocol) {
|
|
- if (this._isInvalid)
|
|
|
|
|
|
+ if (this._isInvalid) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
parse.call(this, protocol + ':', 'scheme start');
|
|
parse.call(this, protocol + ':', 'scheme start');
|
|
},
|
|
},
|
|
|
|
|
|
@@ -3230,8 +3246,9 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
this._host + ':' + this._port : this._host;
|
|
this._host + ':' + this._port : this._host;
|
|
},
|
|
},
|
|
set host(host) {
|
|
set host(host) {
|
|
- if (this._isInvalid || !this._isRelative)
|
|
|
|
|
|
+ if (this._isInvalid || !this._isRelative) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
parse.call(this, host, 'host');
|
|
parse.call(this, host, 'host');
|
|
},
|
|
},
|
|
|
|
|
|
@@ -3239,8 +3256,9 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
return this._host;
|
|
return this._host;
|
|
},
|
|
},
|
|
set hostname(hostname) {
|
|
set hostname(hostname) {
|
|
- if (this._isInvalid || !this._isRelative)
|
|
|
|
|
|
+ if (this._isInvalid || !this._isRelative) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
parse.call(this, hostname, 'hostname');
|
|
parse.call(this, hostname, 'hostname');
|
|
},
|
|
},
|
|
|
|
|
|
@@ -3248,8 +3266,9 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
return this._port;
|
|
return this._port;
|
|
},
|
|
},
|
|
set port(port) {
|
|
set port(port) {
|
|
- if (this._isInvalid || !this._isRelative)
|
|
|
|
|
|
+ if (this._isInvalid || !this._isRelative) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
parse.call(this, port, 'port');
|
|
parse.call(this, port, 'port');
|
|
},
|
|
},
|
|
|
|
|
|
@@ -3258,35 +3277,40 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
'/' + this._path.join('/') : this._schemeData;
|
|
'/' + this._path.join('/') : this._schemeData;
|
|
},
|
|
},
|
|
set pathname(pathname) {
|
|
set pathname(pathname) {
|
|
- if (this._isInvalid || !this._isRelative)
|
|
|
|
|
|
+ if (this._isInvalid || !this._isRelative) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
this._path = [];
|
|
this._path = [];
|
|
parse.call(this, pathname, 'relative path start');
|
|
parse.call(this, pathname, 'relative path start');
|
|
},
|
|
},
|
|
|
|
|
|
get search() {
|
|
get search() {
|
|
- return this._isInvalid || !this._query || '?' == this._query ?
|
|
|
|
|
|
+ return this._isInvalid || !this._query || '?' === this._query ?
|
|
'' : this._query;
|
|
'' : this._query;
|
|
},
|
|
},
|
|
set search(search) {
|
|
set search(search) {
|
|
- if (this._isInvalid || !this._isRelative)
|
|
|
|
|
|
+ if (this._isInvalid || !this._isRelative) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
this._query = '?';
|
|
this._query = '?';
|
|
- if ('?' == search[0])
|
|
|
|
|
|
+ if ('?' === search[0]) {
|
|
search = search.slice(1);
|
|
search = search.slice(1);
|
|
|
|
+ }
|
|
parse.call(this, search, 'query');
|
|
parse.call(this, search, 'query');
|
|
},
|
|
},
|
|
|
|
|
|
get hash() {
|
|
get hash() {
|
|
- return this._isInvalid || !this._fragment || '#' == this._fragment ?
|
|
|
|
|
|
+ return this._isInvalid || !this._fragment || '#' === this._fragment ?
|
|
'' : this._fragment;
|
|
'' : this._fragment;
|
|
},
|
|
},
|
|
set hash(hash) {
|
|
set hash(hash) {
|
|
- if (this._isInvalid)
|
|
|
|
|
|
+ if (this._isInvalid) {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
this._fragment = '#';
|
|
this._fragment = '#';
|
|
- if ('#' == hash[0])
|
|
|
|
|
|
+ if ('#' === hash[0]) {
|
|
hash = hash.slice(1);
|
|
hash = hash.slice(1);
|
|
|
|
+ }
|
|
parse.call(this, hash, 'fragment');
|
|
parse.call(this, hash, 'fragment');
|
|
},
|
|
},
|
|
|
|
|
|
@@ -3318,18 +3342,17 @@ function loadJpegStream(id, imageUrl, objs) {
|
|
// Copy over the static methods
|
|
// Copy over the static methods
|
|
var OriginalURL = scope.URL;
|
|
var OriginalURL = scope.URL;
|
|
if (OriginalURL) {
|
|
if (OriginalURL) {
|
|
- jURL.createObjectURL = function(blob) {
|
|
|
|
|
|
+ JURL.createObjectURL = function(blob) {
|
|
// IE extension allows a second optional options argument.
|
|
// IE extension allows a second optional options argument.
|
|
// http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx
|
|
// http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx
|
|
return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
|
|
return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
|
|
};
|
|
};
|
|
- jURL.revokeObjectURL = function(url) {
|
|
|
|
|
|
+ JURL.revokeObjectURL = function(url) {
|
|
OriginalURL.revokeObjectURL(url);
|
|
OriginalURL.revokeObjectURL(url);
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
- scope.URL = jURL;
|
|
|
|
- /* jshint ignore:end */
|
|
|
|
|
|
+ scope.URL = JURL;
|
|
})(globalScope);
|
|
})(globalScope);
|
|
|
|
|
|
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
|
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|