From b575055d7ecd6ab46ca018baaa23976e33eafbc9 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 10 Oct 2016 14:40:49 -0700 Subject: [PATCH] inherit user-specific MenuItem properties more safely --- lib/browser/api/menu-item.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/browser/api/menu-item.js b/lib/browser/api/menu-item.js index 8103aaf2b7..98b8e9980e 100644 --- a/lib/browser/api/menu-item.js +++ b/lib/browser/api/menu-item.js @@ -7,12 +7,10 @@ let nextCommandId = 0 const MenuItem = function (options) { const {Menu} = require('electron') - // Clone and sanitize the provided options - options = Object.assign({}, options) - delete options.overrideProperty - delete options.overrideReadOnlyProperty - - Object.assign(this, options) + // Preserve extra fields specified by user + for (let key in options) { + if (!(key in this)) this[key] = options[key] + } if (this.submenu != null && this.submenu.constructor !== Menu) { this.submenu = Menu.buildFromTemplate(this.submenu)