From c6b798e366ccf92b00aa9d0c46c38e7aa6fa6ea1 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 21 Dec 2018 23:11:47 -0700 Subject: [PATCH] update menu and misc --- default_app/menu.js | 8 ++++---- default_app/renderer.js | 2 +- docs/api/menu.md | 2 +- docs/api/webview-tag.md | 2 +- docs/tutorial/security.md | 2 +- spec/api-remote-spec.js | 2 +- spec/api-shell-spec.js | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/default_app/menu.js b/default_app/menu.js index 6dd37b2d32875..6fa94852984bb 100644 --- a/default_app/menu.js +++ b/default_app/menu.js @@ -77,13 +77,13 @@ const setDefaultApplicationMenu = () => { { label: 'Learn More', click () { - shell.openExternal('https://electronjs.org') + shell.openExternalSync('https://electronjs.org') } }, { label: 'Documentation', click () { - shell.openExternal( + shell.openExternalSync( `https://github.com/electron/electron/tree/v${process.versions.electron}/docs#readme` ) } @@ -91,13 +91,13 @@ const setDefaultApplicationMenu = () => { { label: 'Community Discussions', click () { - shell.openExternal('https://discuss.atom.io/c/electron') + shell.openExternalSync('https://discuss.atom.io/c/electron') } }, { label: 'Search Issues', click () { - shell.openExternal('https://github.com/electron/electron/issues') + shell.openExternalSync('https://github.com/electron/electron/issues') } } ] diff --git a/default_app/renderer.js b/default_app/renderer.js index b971f9fb16e6f..1783fcf067362 100644 --- a/default_app/renderer.js +++ b/default_app/renderer.js @@ -19,7 +19,7 @@ function initialize () { const openLinkExternally = (e) => { e.preventDefault() - shell.openExternal(url) + shell.openExternalSync(url) } link.addEventListener('click', openLinkExternally) diff --git a/docs/api/menu.md b/docs/api/menu.md index 0363ffdb49506..b096d59ad38b3 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -198,7 +198,7 @@ const template = [ submenu: [ { label: 'Learn More', - click () { require('electron').shell.openExternal('https://electronjs.org') } + click () { require('electron').shell.openExternalSync('https://electronjs.org') } } ] } diff --git a/docs/api/webview-tag.md b/docs/api/webview-tag.md index ad0afaa27f7d7..bab79f4086b41 100644 --- a/docs/api/webview-tag.md +++ b/docs/api/webview-tag.md @@ -782,7 +782,7 @@ const webview = document.querySelector('webview') webview.addEventListener('new-window', (e) => { const protocol = require('url').parse(e.url).protocol if (protocol === 'http:' || protocol === 'https:') { - shell.openExternal(e.url) + shell.openExternalSync(e.url) } }) ``` diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index b9e4a0fd28d4c..4a3300ee7f243 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -639,7 +639,7 @@ app.on('web-contents-created', (event, contents) => { // to open this event's url in the default browser. event.preventDefault() - shell.openExternal(navigationUrl) + shell.openExternalSync(navigationUrl) }) }) ``` diff --git a/spec/api-remote-spec.js b/spec/api-remote-spec.js index 77956cf7d18e5..bb87bd72cdbba 100644 --- a/spec/api-remote-spec.js +++ b/spec/api-remote-spec.js @@ -184,7 +184,7 @@ describe('remote module', () => { assert.strictEqual(typeof remote.app.getPath, 'function') assert.strictEqual(typeof remote.webContents.getFocusedWebContents, 'function') assert.strictEqual(typeof remote.clipboard.readText, 'function') - assert.strictEqual(typeof remote.shell.openExternal, 'function') + assert.strictEqual(typeof remote.shell.openExternalSync, 'function') }) it('returns toString() of original function via toString()', () => { diff --git a/spec/api-shell-spec.js b/spec/api-shell-spec.js index 17bb224078234..79f23d916a318 100644 --- a/spec/api-shell-spec.js +++ b/spec/api-shell-spec.js @@ -35,7 +35,6 @@ describe('shell module', () => { if (process.platform !== 'linux') this.skip() process.env.DE = 'generic' - process.env.DISPLAY = '' const tests = [ { BROWSER: '/bin/true', expected: true }, { BROWSER: '/bin/false', expected: false } @@ -43,6 +42,7 @@ describe('shell module', () => { for (const test of tests) { const { BROWSER, expected } = test + process.env.DISPLAY = '' process.env.BROWSER = BROWSER const actual = shell.openExternalSync('http://www.example.com') assert.strictEqual(expected, actual)