From cd819e4d2e1b38925fe09efdff002b3aecf86baa Mon Sep 17 00:00:00 2001 From: portix Date: Wed, 5 Sep 2012 00:02:31 +0200 Subject: Update requestpolicy, use Object.getPrivate --- extensions/requestpolicy | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'extensions/requestpolicy') diff --git a/extensions/requestpolicy b/extensions/requestpolicy index e7ed941b..5ec6d6d4 100644 --- a/extensions/requestpolicy +++ b/extensions/requestpolicy @@ -120,18 +120,15 @@ var sigs = { var persistentList = null; var tmpList = {}; -var getPrivate = (function() { - var priv = "_requestPolicy" + parseInt(Math.random() * 9999999999, 10); +var getPrivate = (function () { + var identifier = {}; return function (wv) { - var o = wv[priv]; - if (o === undefined) { - o = { domains : [], blocked : 0 }; - Object.defineProperty(wv, priv, { - value : o, - writable : true - }); + var p = wv.getPrivate("foo", identifier); + if (p === null) { + p = { domains : [], blocked : 0 }; + wv.setPrivate("foo", p, identifier); } - return o; + return p; }; })(); -- cgit v1.2.3