mirror of
https://github.com/rhysd/Mstdn.git
synced 2025-02-01 05:52:11 +01:00
avoid crash problem at preventing 'new-window' event (#1)
https://github.com/electron/electron/issues/9230
This commit is contained in:
parent
952be70e4d
commit
4169bcf902
@ -4,6 +4,7 @@ import {app} from 'electron';
|
||||
export const IS_DEBUG = process.env.NODE_ENV === 'development';
|
||||
export const IS_DARWIN = process.platform === 'darwin';
|
||||
export const IS_WINDOWS = process.platform === 'win32';
|
||||
export const IS_LINUX = process.platform === 'linux';
|
||||
export const APP_ICON = path.join(__dirname, '..', 'resources', 'icon', 'icon.png');
|
||||
export const PRELOAD_JS = path.join(__dirname, '..', 'renderer', 'preload.js');
|
||||
export const DATA_DIR = app.getPath('userData');
|
||||
|
@ -4,7 +4,9 @@ import * as menubar from 'menubar';
|
||||
import {Config, Account} from './config';
|
||||
import {partitionForAccount} from './account_switcher';
|
||||
import log from './log';
|
||||
import {IS_DEBUG, IS_DARWIN, IS_WINDOWS, APP_ICON, PRELOAD_JS, trayIcon} from './common';
|
||||
import {IS_DEBUG, IS_DARWIN, IS_WINDOWS, IS_LINUX, APP_ICON, PRELOAD_JS, trayIcon} from './common';
|
||||
|
||||
const ELECTRON_ISSUE_9230 = IS_WINDOWS || IS_LINUX;
|
||||
|
||||
export default class Window {
|
||||
static create(account: Account, config: Config, mb: Menubar.MenubarApp | null = null) {
|
||||
@ -34,9 +36,10 @@ export default class Window {
|
||||
log.debug('Opened URL with external browser (will-navigate)', url);
|
||||
});
|
||||
browser.webContents.on('new-window', (e, url) => {
|
||||
if (IS_WINDOWS) {
|
||||
if (ELECTRON_ISSUE_9230) {
|
||||
// XXX:
|
||||
// On Windows, rel="noopener" lets app crash on preventing the event.
|
||||
// On Windows or Linux, rel="noopener" lets app crash on preventing the event.
|
||||
// Issue: https://github.com/electron/electron/issues/9230
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
|
@ -37,12 +37,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/rhysd/Mstdn#readme",
|
||||
"devDependencies": {
|
||||
"@types/electron": "^1.4.35",
|
||||
"@types/electron": "^1.4.37",
|
||||
"@types/electron-window-state": "^2.0.28",
|
||||
"@types/loglevel": "^1.4.29",
|
||||
"@types/menubar": "^5.1.3",
|
||||
"@types/mousetrap": "^1.5.33",
|
||||
"@types/node": "^7.0.12",
|
||||
"@types/node": "^7.0.13",
|
||||
"browserify": "^14.3.0",
|
||||
"electron-packager": "^8.6.0",
|
||||
"npm-run-all": "^4.0.2",
|
||||
@ -50,7 +50,7 @@
|
||||
"typescript": "^2.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"electron": "^1.6.2",
|
||||
"electron": "^1.6.5",
|
||||
"electron-window-state": "^4.1.1",
|
||||
"loglevel": "^1.4.1",
|
||||
"menubar": "github:rhysd/menubar#mstdn",
|
||||
|
Loading…
x
Reference in New Issue
Block a user