From 798333a044fd0742e1561621e7b1498d21ba5ef7 Mon Sep 17 00:00:00 2001 From: David Creswick Date: Thu, 4 Apr 2013 09:40:00 +0300 Subject: [PATCH] Bug 777877 - Switch CssRuleView.jsm back to WeakMaps; r=mratcliffe --- .../devtools/styleinspector/CssRuleView.jsm | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/browser/devtools/styleinspector/CssRuleView.jsm b/browser/devtools/styleinspector/CssRuleView.jsm index 0a6c0f64963..8b3871d1d52 100644 --- a/browser/devtools/styleinspector/CssRuleView.jsm +++ b/browser/devtools/styleinspector/CssRuleView.jsm @@ -74,12 +74,8 @@ function ElementStyle(aElement, aStore) this.store.userProperties = new UserProperties(); } - if (this.store.disabled) { - this.store.disabled = aStore.disabled; - } else { - // FIXME: This should be a WeakMap once bug 753517 is fixed. - // See Bug 777373 for details. - this.store.disabled = new Map(); + if (!("disabled" in this.store)) { + this.store.disabled = new WeakMap(); } let doc = aElement.ownerDocument; @@ -1670,9 +1666,7 @@ TextPropertyEditor.prototype = { */ function UserProperties() { - // FIXME: This should be a WeakMap once bug 753517 is fixed. - // See Bug 777373 for details. - this.map = new Map(); + this.weakMap = new WeakMap(); } UserProperties.prototype = { @@ -1692,7 +1686,7 @@ UserProperties.prototype = { * otherwise. */ getProperty: function UP_getProperty(aStyle, aName, aComputedValue) { - let entry = this.map.get(aStyle, null); + let entry = this.weakMap.get(aStyle, null); if (entry && aName in entry) { let item = entry[aName]; @@ -1721,13 +1715,13 @@ UserProperties.prototype = { * The value of the property to set. */ setProperty: function UP_setProperty(aStyle, aName, aComputedValue, aUserValue) { - let entry = this.map.get(aStyle, null); + let entry = this.weakMap.get(aStyle, null); if (entry) { entry[aName] = { computed: aComputedValue, user: aUserValue }; } else { let props = {}; props[aName] = { computed: aComputedValue, user: aUserValue }; - this.map.set(aStyle, props); + this.weakMap.set(aStyle, props); } }, @@ -1740,7 +1734,7 @@ UserProperties.prototype = { * The name of the property to check. */ contains: function UP_contains(aStyle, aName) { - let entry = this.map.get(aStyle, null); + let entry = this.weakMap.get(aStyle, null); return !!entry && aName in entry; }, };