Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron v9 upgrade #984

Closed
wants to merge 2 commits into from
Closed

Electron v9 upgrade #984

wants to merge 2 commits into from

Conversation

manavmehta
Copy link
Collaborator

@manavmehta manavmehta commented Jun 22, 2020

What's this PR do?
Upgrade to electron v9 (9.1.0)

You have tested this PR on:

  • macOS Catalina 10.15.5
  • Windows
  • Linux/Ubuntu

Structured Clone Algorithm Checklist (Check if working)

  • Sidebar
  • DevTools for Active Tab
  • Menubar menu items

app/renderer/js/utils/link-util.ts Outdated Show resolved Hide resolved
app/renderer/js/utils/link-util.ts Outdated Show resolved Hide resolved
@andersk
Copy link
Member

andersk commented Jul 1, 2020

I know this is WIP and doesn’t work yet, but the getWebContents change is fine to do in Electron 8, so I split out that part and merged it as e97ab2e.

@@ -36,7 +36,7 @@ export async function openBrowser(url: URL): Promise<void> {
</body>
</html>
`);
shell.openItem(file);
await shell.openPath(file);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manavmehta Can we also utilize the error message in the API design https://github.com/electron/governance/blob/master/wg-api/spec-documents/shell-openitem.md
in case an error occurs ? Just to be safe in this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vsvipul I have added a logger instance for the same. Do you have something else in mind?

@vsvipul
Copy link
Collaborator

vsvipul commented Jul 17, 2020

Checked the breaking changes
The getWebContents change is already fixed in master.
The shell changes are handled in this PR.
Rest of the breaking changes should not be relevant for our case. I still didn't understand the change "IPC between main and renderer processes now uses the Structured Clone Algorithm" and what we need to check in this case. If someone could look into that, that would be great!

@andersk
Copy link
Member

andersk commented Jul 23, 2020

The breaking part of the Structured Clone Algorithm change is

NOTE: Objects that aren't serializable with V8's Structured Clone algorithm, such as functions, DOM objects, special Node/Electron objects like process.env or WebContents, or any objects containing such items will be serialized with the old base::Value-based algorithm. However, this behavior is deprecated and will throw an exception beginning with Electron 9.

To see an example of what happens when we try to transmit a non-serializable object, here’s an error we get in the app console at startup:

Uncaught (in promise) Error: An object could not be cloned.
    at EventEmitter.i.send.i.send (electron/js2c/renderer_init.js:74)
    at ServerManagerView.activateTab (/home/anders/zulip/zulip-desktop/app/renderer/js/main.js:539)
    at ServerManagerView.initTabs (/home/anders/zulip/zulip-desktop/app/renderer/js/main.js:265)
    at async ServerManagerView.init (/home/anders/zulip/zulip-desktop/app/renderer/js/main.js:92)
    at async /home/anders/zulip/zulip-desktop/app/renderer/js/main.js:890

This leaves much of the app non-functional (e.g. the buttons for add organization, do not disturb, reload, back, settings).

@zulipbot
Copy link
Member

Heads up @manavmehta, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

@andersk
Copy link
Member

andersk commented Jul 24, 2020

Note that the Spectron version is tied to the Electron version, so they need to be upgraded simultaneously. I’ve done a full dependency upgrade in 0f1245b, including Electron 9 and Spectron 11.

I’m not sure that writing a log message to a separate log file nobody will read is a helpful way to deal with a failure to launch a web browser, so I’ll leave that for future discussion.

@manavmehta
Copy link
Collaborator Author

Sure, I'll keep that in mind for further upgrades. Thanks.
Closing this in favor of 0f1245b

@manavmehta manavmehta closed this Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants