summaryrefslogtreecommitdiff
path: root/lib/url.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2016-02-18 11:17:56 -0500
committerRich Trott <rtrott@gmail.com>2016-02-18 09:55:03 -0800
commit7d1d3a6621b9a6599b0ee139964afd6b2ca38c6d (patch)
tree124abdcb5b9830d69e58f50ac53f4c258643c45d /lib/url.js
parentff0d3393249884e593832e38f05c2691c6052c66 (diff)
downloadandroid-node-v8-7d1d3a6621b9a6599b0ee139964afd6b2ca38c6d.tar.gz
android-node-v8-7d1d3a6621b9a6599b0ee139964afd6b2ca38c6d.tar.bz2
android-node-v8-7d1d3a6621b9a6599b0ee139964afd6b2ca38c6d.zip
url: fix lint and deopt issues
The deopt issues arose from the use of const in specific situations that v8 does not fully support yet. Fixes: https://github.com/nodejs/node/issues/5299 PR-URL: https://github.com/nodejs/node/pull/5300 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'lib/url.js')
-rw-r--r--lib/url.js48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/url.js b/lib/url.js
index c1e7ed86df..6ffec081f6 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -81,17 +81,18 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
var end = -1;
var rest = '';
var lastPos = 0;
- for (var i = 0, inWs = false, split = false; i < url.length; ++i) {
- var code = url.charCodeAt(i);
+ var i = 0;
+ for (var inWs = false, split = false; i < url.length; ++i) {
+ const code = url.charCodeAt(i);
// Find first and last non-whitespace characters for trimming
- var isWs = code === 32/* */ ||
- code === 9/*\t*/ ||
- code === 13/*\r*/ ||
- code === 10/*\n*/ ||
- code === 12/*\f*/ ||
- code === 160/*\u00A0*/ ||
- code === 65279/*\uFEFF*/;
+ const isWs = code === 32/* */ ||
+ code === 9/*\t*/ ||
+ code === 13/*\r*/ ||
+ code === 10/*\n*/ ||
+ code === 12/*\f*/ ||
+ code === 160/*\u00A0*/ ||
+ code === 65279/*\uFEFF*/;
if (start === -1) {
if (isWs)
continue;
@@ -153,7 +154,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
if (!slashesDenoteHost && !hasHash) {
// Try fast path regexp
- var simplePath = simplePathPattern.exec(rest);
+ const simplePath = simplePathPattern.exec(rest);
if (simplePath) {
this.path = rest;
this.href = rest;
@@ -215,7 +216,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
var hostEnd = -1;
var atSign = -1;
var nonHost = -1;
- for (var i = 0; i < rest.length; ++i) {
+ for (i = 0; i < rest.length; ++i) {
switch (rest.charCodeAt(i)) {
case 9: // '\t'
case 10: // '\n'
@@ -255,7 +256,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
if (hostEnd !== -1)
break;
}
- var start = 0;
+ start = 0;
if (atSign !== -1) {
this.auth = decodeURIComponent(rest.slice(0, atSign));
start = atSign + 1;
@@ -284,9 +285,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
hostname.charCodeAt(hostname.length - 1) === 93/*]*/;
// validate a little.
- var result;
if (!ipv6Hostname) {
- result = validateHostname(this, rest, hostname);
+ const result = validateHostname(this, rest, hostname);
if (result !== undefined)
rest = result;
}
@@ -326,15 +326,15 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
// First, make 100% sure that any "autoEscape" chars get
// escaped, even if encodeURIComponent doesn't think they
// need to be.
- result = autoEscapeStr(rest);
+ const result = autoEscapeStr(rest);
if (result !== undefined)
rest = result;
}
var questionIdx = -1;
var hashIdx = -1;
- for (var i = 0; i < rest.length; ++i) {
- var code = rest.charCodeAt(i);
+ for (i = 0; i < rest.length; ++i) {
+ const code = rest.charCodeAt(i);
if (code === 35/*#*/) {
this.hash = rest.slice(i);
hashIdx = i;
@@ -378,8 +378,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
// to support http.request
if (this.pathname || this.search) {
- var p = this.pathname || '';
- var s = this.search || '';
+ const p = this.pathname || '';
+ const s = this.search || '';
this.path = p + s;
}
@@ -720,17 +720,17 @@ Url.prototype.resolveObject = function(relative) {
return result;
}
- const isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/');
- const isRelAbs = (
+ var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/');
+ var isRelAbs = (
relative.host ||
relative.pathname && relative.pathname.charAt(0) === '/'
);
var mustEndAbs = (isRelAbs || isSourceAbs ||
(result.host && relative.pathname));
- const removeAllDots = mustEndAbs;
+ var removeAllDots = mustEndAbs;
var srcPath = result.pathname && result.pathname.split('/') || [];
- const relPath = relative.pathname && relative.pathname.split('/') || [];
- const psychotic = result.protocol && !slashedProtocol[result.protocol];
+ var relPath = relative.pathname && relative.pathname.split('/') || [];
+ var psychotic = result.protocol && !slashedProtocol[result.protocol];
// if the url is a non-slashed url, then relative
// links like ../.. should be able