From 708f39a1a51c9e4fc0d2d679f530033a84a4d4c3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 20 Feb 2018 14:02:24 -0600 Subject: [PATCH] update a few menu.popup() calls to use the new API --- lib/browser/api/web-contents.js | 7 ++++++- lib/renderer/inspector.js | 2 +- spec/api-menu-spec.js | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index 20025652ef86..749945272cff 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -293,7 +293,12 @@ WebContents.prototype._init = function () { this.on('pepper-context-menu', function (event, params, callback) { // Access Menu via electron.Menu to prevent circular require. const menu = electron.Menu.buildFromTemplate(params.menu) - menu.popup(event.sender.getOwnerBrowserWindow(), params.x, params.y, callback) + menu.popup({ + window: event.sender.getOwnerBrowserWindow(), + x: params.x, + y: params.y, + callback: callback + }) }) // The devtools requests the webContents to reload. diff --git a/lib/renderer/inspector.js b/lib/renderer/inspector.js index 0fc7928d61f1..89048d3c7922 100644 --- a/lib/renderer/inspector.js +++ b/lib/renderer/inspector.js @@ -63,7 +63,7 @@ const createMenu = function (x, y, items) { // The menu is expected to show asynchronously. setTimeout(function () { - menu.popup(remote.getCurrentWindow()) + menu.popup({window: remote.getCurrentWindow()}) }) } diff --git a/spec/api-menu-spec.js b/spec/api-menu-spec.js index f9d35f0a0c4d..27a26e9a4a61 100644 --- a/spec/api-menu-spec.js +++ b/spec/api-menu-spec.js @@ -334,12 +334,12 @@ describe('Menu module', () => { it('should emit menu-will-show event', (done) => { menu.on('menu-will-show', () => { done() }) - menu.popup(w) + menu.popup({window: w}) }) it('should emit menu-will-close event', (done) => { menu.on('menu-will-close', () => { done() }) - menu.popup(w) + menu.popup({window: w}) menu.closePopup() })