Bug 777877 - Switch CssRuleView.jsm back to WeakMaps; r=mratcliffe

This commit is contained in:
David Creswick 2013-04-04 09:40:00 +03:00
Родитель 107735cc70
Коммит 74ef6ea2eb
1 изменённых файлов: 7 добавлений и 13 удалений

Просмотреть файл

@ -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;
},
};