www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit fa039971e6875bbf209f7f6f2062e36ead310cac
parent f376db070519056f475b891764ee92bbce3697e4
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 13 May 2015 13:43:05 -0400

Fixes #714, Zotero.defineProperty() lazy mode doesn't work

Patch from @aurimasv

Diffstat:
Mchrome/content/zotero/xpcom/zotero.js | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js @@ -1424,9 +1424,17 @@ Components.utils.import("resource://gre/modules/osfile.jsm"); if (opts) { if (opts.lazy && d.get) { let getter = d.get; + d.configurable = true; // Make sure we can change the property later d.get = function() { - var val = getter.call(this); - this[prop] = val; // Replace getter with value + let val = getter.call(this); + + // Redefine getter on this object as non-writable value + delete d.set; + delete d.get; + d.writable = false; + d.value = val; + Object.defineProperty(this, prop, d); + return val; } }