diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-09-15 11:47:33 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-09-15 11:48:37 -0700 |
commit | a1bafc55665e9fe17c831ca23193cf51027af776 (patch) | |
tree | d3f1d0fd9c0fd9a358953fb565a9a47b50263e58 /lib | |
parent | 1b15af9dd2bf4adb7a2e73ae17a12e2e98a88f72 (diff) | |
parent | e06ce7562ca568ca9fa8072fbd554da4d20dc779 (diff) | |
download | node-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.js | 11 | ||||
-rw-r--r-- | lib/querystring.js | 10 | ||||
-rw-r--r-- | lib/repl.js | 10 |
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; } |