From 4984e87ade59276734b4878c2df2b7453cd843f0 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 14 Oct 2014 22:42:25 -0400 Subject: [PATCH] Reinstate __exposedProps__ This is ignored in Firefox 33, but seemingly still necessary in Firefox 32 --- .../zotero/xpcom/translation/translate_firefox.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index 151a4e07bd..b2de56159f 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -450,9 +450,11 @@ Zotero.Translate.SandboxManager.prototype = { "importObject":function(object, passAsFirstArgument, attachTo) { if(!attachTo) attachTo = this.sandbox.Zotero; if(attachTo.wrappedJSObject) attachTo = attachTo.wrappedJSObject; - var sandbox = this.sandbox, me = this; - for(var key in (object.__exposedProps__ ? object.__exposedProps__ : object)) { + var newExposedProps = false, sandbox = this.sandbox, me = this; + if(!object.__exposedProps__) newExposedProps = {}; + for(var key in (newExposedProps ? object : object.__exposedProps__)) { let localKey = key; + if(newExposedProps) newExposedProps[localKey] = "r"; var type = typeof object[localKey]; var isFunction = type === "function"; @@ -490,6 +492,12 @@ Zotero.Translate.SandboxManager.prototype = { attachTo[localKey] = object[localKey]; } } + + if(newExposedProps) { + attachTo.__exposedProps__ = newExposedProps; + } else { + attachTo.__exposedProps__ = object.__exposedProps__; + } }, "_canCopy":function(obj) { @@ -507,7 +515,7 @@ Zotero.Translate.SandboxManager.prototype = { * @return {Object} */ "_copyObject":function(obj, wm) { - if(!this._canCopy(obj)) return obj + if(!this._canCopy(obj)) return obj; if(!wm) wm = new WeakMap(); var obj2 = (obj.constructor.name === "Array" ? this.sandbox.Array() : this.sandbox.Object()); var wobj2 = obj2.wrappedJSObject ? obj2.wrappedJSObject : obj2;