fixing hasOwnProperty lookups

This commit is contained in:
Danny Yoo 2013-03-07 12:30:41 -07:00
parent 2ff7f10c03
commit d4c9c5efdb
8 changed files with 19 additions and 8 deletions

View File

@ -68,7 +68,7 @@
(display "M.params.currentSuccessHandler = success;\n" op)
(display #<<EOF
for (param in params) {
if (params.hasOwnProperty(param)) {
if (Object.hasOwnProperty.call(params, param)) {
M.params[param] = params[param];
}
}

View File

@ -733,7 +733,7 @@ var invokeMainModule = function() {
M.params.currentErrorDisplayer(
M, $(plt.baselib.format.toDomNode(e.stack || e)).css('color', 'red'));
if (e.hasOwnProperty('racketError') &&
if (Object.hasOwnProperty.call(e,'racketError') &&
plt.baselib.exceptions.isExn(e.racketError)) {
contMarkSet = plt.baselib.exceptions.exnContMarks(e.racketError);
contextDiv = $('<div/>');

View File

@ -199,12 +199,13 @@
var hasOwnProperty = {}.hasOwnProperty;
var ToDomNodeParameters = function(params) {
if (! params) { params = {}; }
var k;
for (k in params) {
if (params.hasOwnProperty(k)) {
if (hasOwnProperty.call(params, k)) {
this[k] = params[k];
}
}

View File

@ -14,10 +14,12 @@
var keywordCache = {};
var hasOwnProperty = {}.hasOwnProperty;
// makeInstance: string -> Keyword.
Keyword.makeInstance = function (val) {
// To ensure that we can eq? symbols with equal values.
if (!(keywordCache.hasOwnProperty(val))) {
if (!(hasOwnProperty.call(keywordCache, val))) {
keywordCache[val] = new Keyword(val);
}
return keywordCache[val];

View File

@ -7,6 +7,8 @@
var exports = {};
baselib.modules = exports;
var hasOwnProperty = {}.hasOwnProperty;
var Namespace = function(modrec) {
this.modrec = modrec;
@ -20,7 +22,7 @@
};
Namespace.prototype.hasKey = function(name) {
return this.mapping.hasOwnProperty(name);
return hasOwnProperty.call(this.mapping, name);
};
Namespace.prototype.set = function(name, value) {

View File

@ -69,10 +69,12 @@
// Exports
var hasOwnProperty = {}.hasOwnProperty;
// We first re-export everything in jsnums.
var prop;
for (prop in jsnums) {
if (jsnums.hasOwnProperty(prop)) {
if (hasOwnProperty.call(jsnums,prop)) {
exports[prop] = jsnums[prop];
}
}

View File

@ -17,11 +17,13 @@
var symbolCache = {};
var hasOwnProperty = {}.hasOwnProperty;
// makeSymbol: string -> Symbol.
// Interns a symbol.
var makeSymbol = function (val) {
// To ensure that we can eq? symbols with equal values.
if (!(symbolCache.hasOwnProperty(val))) {
if (!(hasOwnProperty.call(symbolCache,val))) {
symbolCache[val] = new Symbol(val);
}
return symbolCache[val];

View File

@ -20,6 +20,8 @@ if (!(this.plt)) { this.plt = {}; }
var hasOwnProperty = {}.hasOwnProperty;
// clone: object -> object
// Copies an object. The new object should respond like the old
// object, including to things like instanceof.
@ -29,7 +31,7 @@ if (!(this.plt)) { this.plt = {}; }
C.prototype = obj;
var c = new C();
for (property in obj) {
if (obj.hasOwnProperty(property)) {
if (hasOwnProperty.call(obj, property)) {
c[property] = obj[property];
}
}