summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-09-15 11:47:33 -0700
committerRyan Dahl <ry@tinyclouds.org>2011-09-15 11:48:37 -0700
commita1bafc55665e9fe17c831ca23193cf51027af776 (patch)
treed3f1d0fd9c0fd9a358953fb565a9a47b50263e58 /lib
parent1b15af9dd2bf4adb7a2e73ae17a12e2e98a88f72 (diff)
parente06ce7562ca568ca9fa8072fbd554da4d20dc779 (diff)
downloadnode-a1bafc55665e9fe17c831ca23193cf51027af776.tar.gz
Merge remote branch 'origin/v0.4'
Conflicts: deps/http_parser/http_parser.c deps/http_parser/test.c lib/repl.js
Diffstat (limited to 'lib')
-rw-r--r--lib/module.js11
-rw-r--r--lib/querystring.js10
-rw-r--r--lib/repl.js10
3 files changed, 28 insertions, 3 deletions
diff --git a/lib/module.js b/lib/module.js
index 2f8f02ff3..08e8ba155 100644
--- a/lib/module.js
+++ b/lib/module.js
@@ -25,6 +25,15 @@ var runInThisContext = Script.runInThisContext;
var runInNewContext = Script.runInNewContext;
var assert = require('assert').ok;
+
+// If obj.hasOwnProperty has been overridden, then calling
+// obj.hasOwnProperty(prop) will break.
+// See: https://github.com/joyent/node/issues/1707
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+
function Module(id, parent) {
this.id = id;
this.exports = {};
@@ -86,7 +95,7 @@ function statPath(path) {
var packageCache = {};
function readPackage(requestPath) {
- if (packageCache.hasOwnProperty(requestPath)) {
+ if (hasOwnProperty(packageCache, requestPath)) {
return packageCache[requestPath];
}
diff --git a/lib/querystring.js b/lib/querystring.js
index 0effe5b16..58b90250c 100644
--- a/lib/querystring.js
+++ b/lib/querystring.js
@@ -25,6 +25,14 @@ var QueryString = exports;
var urlDecode = process.binding('http_parser').urlDecode;
+// If obj.hasOwnProperty has been overridden, then calling
+// obj.hasOwnProperty(prop) will break.
+// See: https://github.com/joyent/node/issues/1707
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+
function charCode(c) {
return c.charCodeAt(0);
}
@@ -166,7 +174,7 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq) {
var k = QueryString.unescape(x[0], true);
var v = QueryString.unescape(x.slice(1).join(eq), true);
- if (!obj.hasOwnProperty(k)) {
+ if (!hasOwnProperty(obj, k)) {
obj[k] = v;
} else if (!Array.isArray(obj[k])) {
obj[k] = [obj[k], v];
diff --git a/lib/repl.js b/lib/repl.js
index 27eeaf5d1..347f7a0e3 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -46,6 +46,14 @@ var path = require('path');
var fs = require('fs');
var rl = require('readline');
+// If obj.hasOwnProperty has been overridden, then calling
+// obj.hasOwnProperty(prop) will break.
+// See: https://github.com/joyent/node/issues/1707
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+
var context;
var disableColors = true;
@@ -517,7 +525,7 @@ REPLServer.prototype.complete = function(line, callback) {
group.sort();
for (var j = 0; j < group.length; j++) {
c = group[j];
- if (!uniq.hasOwnProperty(c)) {
+ if (!hasOwnProperty(c)) {
completions.push(c);
uniq[c] = true;
}