1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-29 13:15:53 +01:00

Clone arrays assigned to "live" properties, partially to deal with issues with horrid Sandbox proxies and partly for other somewhat obvious reasons.

This commit is contained in:
Kris Maglione
2011-02-04 15:56:23 -05:00
parent e514899d23
commit 6a3d5dcfce
3 changed files with 11 additions and 3 deletions

View File

@@ -18,8 +18,14 @@ var Highlight = Struct("class", "selector", "sites",
Highlight.liveProperty = function (name, prop) {
this.prototype.__defineGetter__(name, function () this.get(name));
this.prototype.__defineSetter__(name, function (val) {
if (isObject(val) && name !== "style" && Object.freeze)
Object.freeze(val);
if (isObject(val) && name !== "style") {
if (isArray(val))
val = Array.slice(val);
else
val = update({}, val);
if (Object.freeze)
Object.freeze(val);
}
this.set(name, val);
if (name === "value" || name === "extends")