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

Upgrade Electron#12300

Merged
as-cii merged 18 commits intomasterfrom
tj-upgrade-electron
Sep 7, 2016
Merged

Upgrade Electron#12300
as-cii merged 18 commits intomasterfrom
tj-upgrade-electron

Conversation

@thomasjo
Copy link
Copy Markdown
Contributor

@thomasjo thomasjo commented Aug 3, 2016

The purpose of this PR is to begin the process of upgrading Electron to the latest release. As of right now, there are a few things that need to be dealt with before that can happen.

The primary problem is that as of Electron v1.1.0, Node.js was upgraded to v6 and that causes some issues. I believe (and hope) that the only major issue is the usage of older version of graceful-fs in a few of our dependencies. Once those have been resolved, I think we'll be able to sort out the remaining issues in Atom core without too many problems. OK, there are more problems than first anticipated — I'll keep updating the task list below as I identify (and fix) problems.

There is another concern though, since Electron v1 removed some deprecated module require bits.

I propose that in this PR, we perform the upgrade process in stages, one minor version bump at a time, to minimize the number of issues and hopefully keep it reasonable.


Fixes #12591

@winstliu
Copy link
Copy Markdown
Contributor

winstliu commented Aug 3, 2016

In case any package authors are looking at this, here's a list of packages that need to be updated:
https://gist.github.com/50Wliu/ef22d45854415842d9c59f562eca99bc

@mnquintana
Copy link
Copy Markdown
Contributor

We should set process.traceDeprecation = true while we're testing this to make sure we haven't missed changing any deprecated stuff. (cf. http://electron.atom.io/blog/2015/11/17/electron-api-changes)

@hultberg
Copy link
Copy Markdown

What is the status on this? Excited to see work on this!

@thomasjo
Copy link
Copy Markdown
Contributor Author

@hultberg We're currently blocked by less/less.js#2953. Hopefully once the Less.js upgrade is dealt with, we can continue the stepwise upgrade towards the latest release of Electron.

@thomasjo
Copy link
Copy Markdown
Contributor Author

thomasjo commented Aug 22, 2016

Updating Electron to v1.1.x (and newer) is currently blocked on path assertions introduced in Node with nodejs/node#5348. Essentially we are no longer allowed to pass undefined to any function in the path module. Since this affects not only Atom core, but all packages, we will have to resolve this somehow.

The "easy" option is to monkey patch the assertPath function in path.js. The hard option is to ensure all instances of undefined are replaced with e.g. "" throughout the entire codebase, including community packages.

Deviating from Node proper by patching in support for undefined does not feel right, but I believe it's the only viable option. If someone has an alternative approach, I'm all 👂👂

@joefitzgerald
Copy link
Copy Markdown
Contributor

joefitzgerald commented Aug 22, 2016

@thomasjo This is unavoidable, as node progresses. I don't think we should patch path functions, as this perpetuates the issue. This was done for a reason, and we should fix any area in core that is affected.

I would advocate for ensuring that we deal with packages that fall afoul of this via:

  • Adding some logic that adds context about how to fix issues that are filed as a result of catching this kind of error
  • Downloading all published packages and identifying any use of path functions; you could then potentially open an issue warning of this upcoming change, giving the package author time to fix it while a) these changes are in master and b) these changes are in beta, and prior to c) these changes being in stable
  • Optionally creating a new channel for electron-latest ("alpha"?) so that we ease the burden of building from source for people who just want to fix their package and don't necessarily want to build from master

@thomasjo
Copy link
Copy Markdown
Contributor Author

@joefitzgerald As we discussed elsewhere, I agree. We should fix this properly, and as mentioned, I believe this will require us to bump Atom's major version since we will likely Break The World™ 🎱

I've started fixing the issues, and will keep updating the PR description as I identify (and fix) problematic code in core and bundled packages. As of writing this, I will at least have to patch tree-view and autocomplete-plus, but I suspect there are others.

Opening PRs on community packages will have to wait, but if someone wants to start testing this PR against their community packages and resolving issues there, that would be amazing 💖

@maxbrunsfeld
Copy link
Copy Markdown
Contributor

@simurai It seems that on this new version of Chrome (52.0.2743.82), the atom-pane-resize-handle elements are not being positioned properly in the flow. I think this is related to 4980ce3 and atom/one-dark-ui@82271d5.

Could you build this branch when you get a chance, and investigate if there's another way to achieve the desired look of the resize handles?

@simurai
Copy link
Copy Markdown
Contributor

simurai commented Aug 26, 2016

@maxbrunsfeld Yes, seems Chromium 52 changed how they handle absolutely positioned flexbox items. Should be fixed by using an extra pseudo-element.

The One + Atom Material themes still need a separate fix for the horizontal handles. 🔜

@nathansobo
Copy link
Copy Markdown
Contributor

@maxbrunsfeld: @thomasjo reports that we're getting IndexDB errors when Atom and Atom Beta are opened side-by-side. I wonder if something about the storage directories isn't being set correctly.

@thomasjo
Copy link
Copy Markdown
Contributor Author

@maxbrunsfeld, @nathansobo: Yeah I can consistently repro this on my machine; start atom-beta from an arbitrary directory, then subsequent launches of atom (with beta still running) causes a IndexDB error.

_users_thomasjo_scratch_cuda_cusolver-qr

@nathansobo
Copy link
Copy Markdown
Contributor

@maxbrunsfeld @thomasjo Apparently this happens on stable/beta as well. It's not related to this branch.

@s0ber
Copy link
Copy Markdown

s0ber commented Aug 31, 2016

@thomasjo @nathansobo Please consider, that Chrome v49 has a very nasty SVG rendering speed downgrade (when rendering text nodes):
https://bugs.chromium.org/p/chromium/issues/detail?id=589525

I am developing a diagram editor (which is an Atom plugin), and when Atom updated to 1.9.9 it became sooo slow. There are O(n^2) computations in chromium engine (which caused those downgrades), and now some interactions in my diagram editor take seconds to complete, while previously there were milliseconds.

It would be really nice to update Chrome version to more performant one as soon as possible. Thanks for your attention.

(I am not creating an issue, since it will be really hard to fix it without updating chromium dependency version.)

update for those, who may struggle with such issue: using <svg:foreignObject> with spans inside really helped.

@as-cii
Copy link
Copy Markdown
Contributor

as-cii commented Sep 7, 2016

For posterity, in #12619 we ended up implementing a slight variation of the routine proposed in the previous comment:

  1. Cancel the close initiated by the user.
  2. Wait until AtomEnvironment.prototype.saveState is resolved (or rejected).
  3. Notify the main process that a window can be closed (emit 'can-close').
  4. In the main process:
    1. If the application was quitting, wait until all the windows notify that they can be closed, then call app.quit.
    2. If the application was not quitting, close only the window for which we have a received a can-close event.

thomasjo and others added 18 commits September 7, 2016 16:31
Signed-off-by: Nathan Sobo <nathan@github.com>
Signed-off-by: Nathan Sobo <nathan@github.com>
Signed-off-by: Nathan Sobo <nathan@github.com>
Signed-off-by: Nathan Sobo <nathan@github.com>
Signed-off-by: Nathan Sobo <nathan@github.com>
Signed-off-by: Nathan Sobo <nathan@github.com>
getComputedStyle seems to return font families this way in Chrome 52
As of Chromium 52 absolutely positioned flexbox items are taken out of the flow. See https://developers.google.com/web/updates/2016/06/absolute-positioned-children?hl=en

To keep it in the flow, we use an absolutely positioned pseudo-element instead.
@thomasjo thomasjo force-pushed the tj-upgrade-electron branch from eb65aac to bb7ff6d Compare September 7, 2016 14:49
@thomasjo
Copy link
Copy Markdown
Contributor Author

thomasjo commented Sep 7, 2016

Rebased and removed my "hacky" attempts at resolving the failing integration test. Hopefully everything should be 💚 now with @as-cii's fix in #12619 🎉

@as-cii as-cii merged commit c397bcd into master Sep 7, 2016
@as-cii as-cii deleted the tj-upgrade-electron branch September 7, 2016 15:52
@as-cii
Copy link
Copy Markdown
Contributor

as-cii commented Sep 7, 2016

Thanks so much @thomasjo, @maxbrunsfeld and everyone else involved in this! ❤️

@v3ss0n
Copy link
Copy Markdown

v3ss0n commented Sep 7, 2016

Yes! Yes!!! I am thinking about using nvm and forget worrying about system node veriosn (6.x vs 4.x) is that a good idea?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mouse scroll misbehaves on Linux after alt-tabbing