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/module.js | |
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/module.js')
-rw-r--r-- | lib/module.js | 11 |
1 files changed, 10 insertions, 1 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]; } |