Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #19373 from atom/electron-4
Browse files Browse the repository at this point in the history
Upgrade to Electron 4
  • Loading branch information
rafeca committed Jul 19, 2019
2 parents 4704c84 + a8e2c83 commit e0a377e
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"url": "https://github.com/atom/atom/issues"
},
"license": "MIT",
"electronVersion": "3.1.10",
"electronVersion": "4.2.7",
"dependencies": {
"@atom/nsfw": "1.0.25",
"@atom/source-map-support": "^0.3.4",
Expand Down
75 changes: 67 additions & 8 deletions script/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"coffeelint": "1.15.7",
"colors": "1.1.2",
"donna": "1.0.16",
"electron-chromedriver": "^3.0.0",
"electron-chromedriver": "^4.2.0",
"electron-link": "0.4.0",
"electron-mksnapshot": "^3.1.10",
"electron-mksnapshot": "^4.2.0",
"electron-packager": "12.2.0",
"@atom/electron-winstaller": "0.0.1",
"eslint": "^5.16.0",
Expand Down
13 changes: 12 additions & 1 deletion spec/integration/helpers/start-atom.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ const chromeDriverDown = done => {
};

const buildAtomClient = async (args, env) => {
// Since ChromeDriver v2.41, ChromeDriver will only connect if, either we precise a port
// for remote debugging, either the embedder (ie electron) made sure to pass `USER_DATA_DIR`
// to the remote debugging server.
// So, for now, we'll just use a random port (we don't care about its value since we're not
// connecting through it).
// (inspired by https://github.com/electron/spectron/pull/361/commits/737db138bd8a6daaf80f9c2bff710ce4a5fff39b).
// TodoElectronIssue: Remove the whole remote-debugging-port param once we upgrade
// to Electron v5, since this was fixes there (see electron/electron#17800).
const randomPort = Math.floor(Math.random() * (9999 - 9000) + 9000);

const userDataDir = temp.mkdirSync('atom-user-data-dir');
const client = await webdriverio.remote({
host: 'localhost',
Expand All @@ -69,7 +79,8 @@ const buildAtomClient = async (args, env) => {
.join(' ')}`,
'dev',
'safe',
`user-data-dir=${userDataDir}`
`user-data-dir=${userDataDir}`,
`remote-debugging-port=${randomPort}`
]
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/menu-manager.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ class MenuManager
# added menu items.
add: (items) ->
items = _.deepClone(items)
@merge(@template, item) for item in items

for item in items
continue unless item.label? # TODO: Should we emit a warning here?
@merge(@template, item)

@update()
new Disposable => @remove(items)

Expand Down
14 changes: 7 additions & 7 deletions src/module-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,18 +285,18 @@ function registerBuiltins(devMode) {
const electronAsarRoot = path.join(process.resourcesPath, 'electron.asar');

const commonRoot = path.join(electronAsarRoot, 'common', 'api');
const commonBuiltins = [
'callbacks-registry',
'clipboard',
'crash-reporter',
'shell'
];
const commonBuiltins = ['clipboard', 'shell'];
for (const builtin of commonBuiltins) {
cache.builtins[builtin] = path.join(commonRoot, `${builtin}.js`);
}

const rendererRoot = path.join(electronAsarRoot, 'renderer', 'api');
const rendererBuiltins = ['ipc-renderer', 'remote', 'screen'];
const rendererBuiltins = [
'crash-reporter',
'ipc-renderer',
'remote',
'screen'
];
for (const builtin of rendererBuiltins) {
cache.builtins[builtin] = path.join(rendererRoot, `${builtin}.js`);
}
Expand Down

0 comments on commit e0a377e

Please sign in to comment.