diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index bec3cce7644e..f50fee6ecb4f 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -45,6 +45,7 @@ Menu.prototype._init = function () { Menu.prototype.popup = function (window, x, y, positioningItem) { let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window] + let opts // menu.popup(x, y, positioningItem) if (!window) { @@ -54,9 +55,16 @@ Menu.prototype.popup = function (window, x, y, positioningItem) { } } + // menu.popup({}) + if (window && typeof window === 'object' && window.constructor && + window.constructor.name !== 'BrowserWindow') { + opts = window // menu.popup(window, {}) - if (x && typeof x === 'object') { - const opts = x + } else if (x && typeof x === 'object') { + opts = x + } + + if (opts) { newX = opts.x newY = opts.y newPosition = opts.positioningItem