diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index cfb00bd45277..4effa10238e6 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -269,7 +269,7 @@ Menu.getApplicationMenu = function() { Menu.sendActionToFirstResponder = bindings.sendActionToFirstResponder; Menu.buildFromTemplate = function(template) { - var insertIndex, item, j, k, key, len, len1, menu, menuItem, positionedTemplate, value; + var insertIndex, item, j, k, key, len, len1, menu, menuItem, positionedTemplate; if (!Array.isArray(template)) { throw new TypeError('Invalid template for Menu'); } @@ -293,9 +293,9 @@ Menu.buildFromTemplate = function(template) { } menuItem = new MenuItem(item); for (key in item) { - value = item[key]; - if (menuItem[key] == null) { - menuItem[key] = value; + // Preserve extra fields specified by user + if (!menuItem.hasOwnProperty(key)) { + menuItem[key] = item[key]; } } menu.append(menuItem);