Skip to content

fix(compass): disable spellcheck before creating window when no network traffic COMPASS-8166 #6853

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

Merged
merged 2 commits into from
Apr 21, 2025

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Apr 9, 2025

COMPASS-8166

We already were disabling the spellcheck when network traffic was disabled, however it looks like it was being disabled after the request for the dictionary would happen. This pr updates when we do the override to happen earlier.

The other change here is ignoring Google's public DNS ip in our no network test as its an expected functionality of chromium:
https://source.chromium.org/chromium/chromium/src/+/main:net/dns/README.md;l=351

// to 2001:4860:4860::8888 (the IPv6 address for Google Public DNS).
(target) =>
!/^127.0.0.1:|^\[::1\]:/.test(target) &&
!/^\[2001:4860:4860::8888\]:443$/.test(target)
Copy link
Collaborator

Choose a reason for hiding this comment

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

And I guess this is something we can't control at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't found one yet.
It seems like electron command line switches redirect it with the host rules / host resolver rules.
https://www.electronjs.org/docs/latest/api/command-line-switches#--host-rulesrules
I'll spend a bit of time looking into that and circle back before merging.

Copy link
Member Author

Choose a reason for hiding this comment

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

Early on in our application code to override the host resolution it looks like we can:

app.commandLine.appendSwitch('host-resolver-rules', 'MAP 2001:4860:4860::8888 some_address');

That will cause all of the network requests to start failing if it doesn't succeed though as I think more of the stack relies on this request for knowing where to send requests. I'm thinking as a fix we could maybe provide users a way to specify this themselves.

I'm going to merge this pr for the other fix and create a follow up ticket and link a todo in the code. I think it still needs a bit of investigation and thought

// Passing a non-resolving URL prevents it from fetching
// as there aren't any options to disable it provided.
// https://github.com/electron/electron/issues/22995
session.defaultSession.setSpellCheckerDictionaryDownloadURL(
Copy link
Contributor

Choose a reason for hiding this comment

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

oh wow. well caught.

Copy link
Contributor

@lerouxb lerouxb left a comment

Choose a reason for hiding this comment

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

nice! tricky one.

@Anemy Anemy merged commit 591eb06 into main Apr 21, 2025
60 of 61 checks passed
@Anemy Anemy deleted the COMPASS-8166-add-google-dns-to-no-traffic-test branch April 21, 2025 16:48
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.

3 participants