mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-31 17:35:46 +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:
@@ -18,8 +18,14 @@ var Highlight = Struct("class", "selector", "sites",
|
|||||||
Highlight.liveProperty = function (name, prop) {
|
Highlight.liveProperty = function (name, prop) {
|
||||||
this.prototype.__defineGetter__(name, function () this.get(name));
|
this.prototype.__defineGetter__(name, function () this.get(name));
|
||||||
this.prototype.__defineSetter__(name, function (val) {
|
this.prototype.__defineSetter__(name, function (val) {
|
||||||
if (isObject(val) && name !== "style" && Object.freeze)
|
if (isObject(val) && name !== "style") {
|
||||||
Object.freeze(val);
|
if (isArray(val))
|
||||||
|
val = Array.slice(val);
|
||||||
|
else
|
||||||
|
val = update({}, val);
|
||||||
|
if (Object.freeze)
|
||||||
|
Object.freeze(val);
|
||||||
|
}
|
||||||
this.set(name, val);
|
this.set(name, val);
|
||||||
|
|
||||||
if (name === "value" || name === "extends")
|
if (name === "value" || name === "extends")
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ Sheet.liveProperty = function (name) {
|
|||||||
let i = this.prototype.members[name];
|
let i = this.prototype.members[name];
|
||||||
this.prototype.__defineGetter__(name, function () this[i]);
|
this.prototype.__defineGetter__(name, function () this[i]);
|
||||||
this.prototype.__defineSetter__(name, function (val) {
|
this.prototype.__defineSetter__(name, function (val) {
|
||||||
|
if (isArray(val))
|
||||||
|
val = Array.slice(val);
|
||||||
if (isArray(val) && Object.freeze)
|
if (isArray(val) && Object.freeze)
|
||||||
Object.freeze(val);
|
Object.freeze(val);
|
||||||
this[i] = val;
|
this[i] = val;
|
||||||
|
|||||||
@@ -1672,7 +1672,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (nodes && node.@key)
|
if (nodes && node.@key)
|
||||||
nodes[node.@key] = domnode;
|
nodes[node.@key] = domnode;
|
||||||
|
|
||||||
if (node.@highlight)
|
if ("@highlight" in node)
|
||||||
highlight.highlightNode(domnode, String(node.@highlight), nodes || true);
|
highlight.highlightNode(domnode, String(node.@highlight), nodes || true);
|
||||||
return domnode;
|
return domnode;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user