summaryrefslogtreecommitdiff
path: root/lib/url.js
diff options
context:
space:
mode:
authorRod Vagg <rod@vagg.org>2015-05-03 15:05:36 -0700
committerRod Vagg <rod@vagg.org>2015-05-03 20:28:51 -0700
commit0f39ef4ca11bf0c6c6891dec3fa0d2d3d16513cb (patch)
tree487d9e9427f0ad87c24908d1ec70cf1c030608f3 /lib/url.js
parent66877216bd833face753d9a5d573ad477895d880 (diff)
downloadandroid-node-v8-0f39ef4ca11bf0c6c6891dec3fa0d2d3d16513cb.tar.gz
android-node-v8-0f39ef4ca11bf0c6c6891dec3fa0d2d3d16513cb.tar.bz2
android-node-v8-0f39ef4ca11bf0c6c6891dec3fa0d2d3d16513cb.zip
Revert "url: fix treatment of some values as non-empty"
This reverts commit 66877216bd833face753d9a5d573ad477895d880. It was agreed that this change contained too much potential ecosystem breakage, particularly around the inability to `delete` properties off a `Url` object. It may be re-introduced for a later release, along with better work on ecosystem compatibility. PR-URL: #1602 Reviewed-By: Mikeal Rogers <mikeal.rogers@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Forrest L Norvell <forrest@npmjs.com> Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Isaac Z. Schlueter <i@izs.me> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'lib/url.js')
-rw-r--r--lib/url.js24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/url.js b/lib/url.js
index df04ebc12a..52c3903876 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -879,7 +879,7 @@ Object.defineProperty(Url.prototype, 'port', {
return null;
},
set: function(v) {
- if (isConsideredEmpty(v)) {
+ if (v === null) {
this._port = -1;
if (this._host)
this._host = null;
@@ -941,7 +941,7 @@ Object.defineProperty(Url.prototype, 'path', {
return (p == null && s) ? ('/' + s) : null;
},
set: function(v) {
- if (isConsideredEmpty(v)) {
+ if (v === null) {
this._pathname = this._search = null;
return;
}
@@ -973,7 +973,7 @@ Object.defineProperty(Url.prototype, 'protocol', {
return proto;
},
set: function(v) {
- if (isConsideredEmpty(v)) {
+ if (v === null) {
this._protocol = null;
} else {
var proto = '' + v;
@@ -1001,7 +1001,7 @@ Object.defineProperty(Url.prototype, 'href', {
var parsesQueryStrings = this._parsesQueryStrings;
// Reset properties.
Url.call(this);
- if (!isConsideredEmpty(v))
+ if (v !== null && v !== '')
this.parse('' + v, parsesQueryStrings, false);
},
enumerable: true,
@@ -1013,7 +1013,7 @@ Object.defineProperty(Url.prototype, 'auth', {
return this._auth;
},
set: function(v) {
- this._auth = isConsideredEmpty(v) ? null : '' + v;
+ this._auth = v === null ? null : '' + v;
this._href = '';
},
enumerable: true,
@@ -1026,7 +1026,7 @@ Object.defineProperty(Url.prototype, 'host', {
return this._host;
},
set: function(v) {
- if (isConsideredEmpty(v)) {
+ if (v === null) {
this._port = -1;
this._hostname = this._host = null;
} else {
@@ -1053,7 +1053,7 @@ Object.defineProperty(Url.prototype, 'hostname', {
return this._hostname;
},
set: function(v) {
- if (isConsideredEmpty(v)) {
+ if (v === null) {
this._hostname = null;
if (this._hasValidPort())
@@ -1080,7 +1080,7 @@ Object.defineProperty(Url.prototype, 'hash', {
return this._hash;
},
set: function(v) {
- if (isConsideredEmpty(v) || v === '#') {
+ if (v === null) {
this._hash = null;
} else {
var hash = '' + v;
@@ -1100,7 +1100,7 @@ Object.defineProperty(Url.prototype, 'search', {
return this._search;
},
set: function(v) {
- if (isConsideredEmpty(v) || v === '?') {
+ if (v === null) {
this._search = this._query = null;
} else {
var search = escapeSearch('' + v);
@@ -1125,7 +1125,7 @@ Object.defineProperty(Url.prototype, 'pathname', {
return this._pathname;
},
set: function(v) {
- if (isConsideredEmpty(v)) {
+ if (v === null) {
this._pathname = null;
} else {
var pathname = escapePathName('' + v).replace(/\\/g, '/');
@@ -1144,10 +1144,6 @@ Object.defineProperty(Url.prototype, 'pathname', {
configurable: true
});
-function isConsideredEmpty(value) {
- return value === null || value === undefined || value === '';
-}
-
// Search `char1` (integer code for a character) in `string`
// starting from `fromIndex` and ending at `string.length - 1`
// or when a stop character is found.