Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/utils.js

Issue 5636077285015552: Issue 656 - Replace some __proto__ with Object.create (Closed)
Patch Set: Created June 23, 2014, 8:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/timeline.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/utils.js
===================================================================
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -534,17 +534,17 @@ let Utils = exports.Utils =
/**
* A cache with a fixed capacity, newer entries replace entries that have been
* stored first.
* @constructor
*/
function Cache(/**Integer*/ size)
{
this._ringBuffer = new Array(size);
- this.data = {__proto__: null};
+ this.data = Object.create(null);
}
exports.Cache = Cache;
Cache.prototype =
{
/**
* Ring buffer storing hash keys, allows determining which keys need to be
* evicted.
@@ -588,17 +588,17 @@ Cache.prototype =
},
/**
* Clears cache contents.
*/
clear: function()
{
this._ringBuffer = new Array(this._ringBuffer.length);
- this.data = {__proto__: null};
+ this.data = Object.create(null);
}
}
// Getters for common services, this should be replaced by Services.jsm in future
XPCOMUtils.defineLazyServiceGetter(Utils, "categoryManager", "@mozilla.org/categorymanager;1", "nsICategoryManager");
XPCOMUtils.defineLazyServiceGetter(Utils, "ioService", "@mozilla.org/network/io-service;1", "nsIIOService");
XPCOMUtils.defineLazyServiceGetter(Utils, "promptService", "@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService");
« no previous file with comments | « lib/timeline.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld