From c700d291e59ffd01f1426ca119d41be9a53aea64 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 15 Aug 2013 16:09:34 +0800 Subject: [PATCH] Don't overwrite existing fields when build menu from template. --- browser/api/lib/menu-item.coffee | 2 +- browser/api/lib/menu.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/api/lib/menu-item.coffee b/browser/api/lib/menu-item.coffee index 9c21ebf3a0b4..b94fdf628534 100644 --- a/browser/api/lib/menu-item.coffee +++ b/browser/api/lib/menu-item.coffee @@ -6,7 +6,7 @@ class MenuItem constructor: (options) -> Menu = require 'menu' - {click, selector, @type, @label, @sublabel, @accelerator, @enabled, @visible, @checked, @groupId, @submenu} = options + {click, @selector, @type, @label, @sublabel, @accelerator, @enabled, @visible, @checked, @groupId, @submenu} = options @type = 'submenu' if not @type? and @submenu? throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu diff --git a/browser/api/lib/menu.coffee b/browser/api/lib/menu.coffee index 52c5f2426dad..14c5b8db15ff 100644 --- a/browser/api/lib/menu.coffee +++ b/browser/api/lib/menu.coffee @@ -58,7 +58,7 @@ Menu.buildFromTemplate = (template) -> item.submenu = Menu.buildFromTemplate item.submenu if item.submenu? menuItem = new MenuItem(item) - menuItem[key] = value for key, value of item + menuItem[key] = value for key, value of item when not menuItem[key]? menu.append menuItem