From 6a3d5dcfceeed29b77eb548fc3d7234c6ece3a00 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 4 Feb 2011 15:56:23 -0500 Subject: [PATCH] Clone arrays assigned to "live" properties, partially to deal with issues with horrid Sandbox proxies and partly for other somewhat obvious reasons. --- common/modules/highlight.jsm | 10 ++++++++-- common/modules/styles.jsm | 2 ++ common/modules/util.jsm | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm index 9065a44f..5c557fc5 100644 --- a/common/modules/highlight.jsm +++ b/common/modules/highlight.jsm @@ -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") diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index adbfd803..ed893775 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -21,6 +21,8 @@ Sheet.liveProperty = function (name) { let i = this.prototype.members[name]; this.prototype.__defineGetter__(name, function () this[i]); this.prototype.__defineSetter__(name, function (val) { + if (isArray(val)) + val = Array.slice(val); if (isArray(val) && Object.freeze) Object.freeze(val); this[i] = val; diff --git a/common/modules/util.jsm b/common/modules/util.jsm index cfb422e9..6b423c66 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -1672,7 +1672,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (nodes && node.@key) nodes[node.@key] = domnode; - if (node.@highlight) + if ("@highlight" in node) highlight.highlightNode(domnode, String(node.@highlight), nodes || true); return domnode; default: