From 3126683b46c4d6e29304b69332b7dcbb39e3cec5 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 7 Oct 2011 07:07:49 -0400 Subject: [PATCH] Fix issue with crufty old mapping aliases. --- common/modules/commands.jsm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 459d4d8c..3c037cef 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -328,10 +328,14 @@ var Command = Class("Command", { }); this.options.forEach(function (opt) { - if ("default" in opt) - Object.defineProperty(res, opt.names[0], - Object.getOwnPropertyDescriptor(opt, "default") || - { configurable: true, enumerable: true, get: function () opt.default }); + if (opt.default !== undefined) { + let prop = Object.getOwnPropertyDescriptor(opt, "default") || + { configurable: true, enumerable: true, get: function () opt.default }; + + if (prop.get && !prop.set) + prop.set = function (val) { Class.replaceProperty(this, opt.names[0], val) }; + Object.defineProperty(res, opt.names[0], prop); + } }); return res;