use hasOwnProperty in for in loops

#450
This commit is contained in:
Tobias Koppers 2014-09-15 10:35:56 +02:00
parent 2eed5961b0
commit 1a10838a61
1 changed files with 27 additions and 21 deletions

View File

@ -367,8 +367,10 @@ var hotInitCode = Template.getFunctionContent(function() {
return; return;
hotRequestedFilesMap[chunkId] = false; hotRequestedFilesMap[chunkId] = false;
for(var moduleId in moreModules) { for(var moduleId in moreModules) {
if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
hotUpdate[moduleId] = moreModules[moduleId]; hotUpdate[moduleId] = moreModules[moduleId];
} }
}
if(--hotWaitingFiles === 0 && hotChunksLoading === 0) { if(--hotWaitingFiles === 0 && hotChunksLoading === 0) {
hotUpdateDownloaded(); hotUpdateDownloaded();
} }
@ -394,8 +396,10 @@ var hotInitCode = Template.getFunctionContent(function() {
} else { } else {
var outdatedModules = []; var outdatedModules = [];
for(var id in hotUpdate) { for(var id in hotUpdate) {
if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
outdatedModules.push(+id); outdatedModules.push(+id);
} }
}
callback(null, outdatedModules); callback(null, outdatedModules);
} }
} }
@ -463,6 +467,7 @@ var hotInitCode = Template.getFunctionContent(function() {
var outdatedModules = []; var outdatedModules = [];
var appliedUpdate = {}; var appliedUpdate = {};
for(var id in hotUpdate) { for(var id in hotUpdate) {
if(Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
var moduleId = +id; var moduleId = +id;
var result = getAffectedStuff(moduleId); var result = getAffectedStuff(moduleId);
if(!result) { if(!result) {
@ -485,6 +490,7 @@ var hotInitCode = Template.getFunctionContent(function() {
} }
} }
} }
}
// Store self accepted outdated modules to require them later by the module system // Store self accepted outdated modules to require them later by the module system
var outdatedSelfAcceptedModules = []; var outdatedSelfAcceptedModules = [];