8000 fix: provide paths for all NetworkContextFilePaths keys by MarshallOfSound · Pull Request #31777 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: provide paths for all NetworkContextFilePaths keys #31777

New issue < 8000 button aria-label="Close dialog" data-close-dialog="" type="button" data-view-component="true" class="Link--muted btn-link position-absolute p-4 right-0">

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 8 commits into from
Nov 15, 2021

Conversation

MarshallOfSound
Copy link
Member

Chromium is currently migrating file paths for the network service to a different path, as such a bunch of path calculations were moved into a config struct that we weren't fully populating.

This populates the struct identically to //chrome.

Refs: https://source.chromium.org/chromium/chromium/src/+/main:services/network/public/mojom/network_context.mojom;l=219;drc=b6e40f8ab247ea209bcecff994386a70a4169e9d
Refs: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/net/profile_network_context_service.cc;l=712;drc=b6e40f8ab247ea209bcecff994386a70a4169e9d;bpv=1;bpt=1

Notes: ~/.config/{App Name} will no longer be incorrectly deleted if it is a symlink on unix systems

@MarshallOfSound MarshallOfSound 8000 added semver/patch backwards-compatible bug fixes fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases target/16-x-y labels Nov 9, 2021
Copy link
Member
@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

Copy link
Member
@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

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

< 8000 td class="blob-code blob-code-addition"> path.Append(chrome::kNetworkDataDirname);
network_context_params->file_paths->unsandboxed_data_path = path;
network_context_params->file_paths->trigger_migration =
features::ShouldTriggerNetworkDataMigration();
Copy link
Member

Choose a reason for hiding this comment

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

Might need to include chrome/browser/browser_features.h

Copy link
Member
@deepak1556 deepak1556 Nov 9, 2021

Choose a reason for hiding this comment

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

Oops forgot that we don't build the entire //chrome/browser target as part of https://github.com/electron/electron/blob/main/chromium_src/BUILD.gn#L13. Will need to add //chrome/browser/browser_features.h, //chrome/browser/browser_features.cc to address ci failure.

@deepak1556
Copy link
Member

TriggerNetworkDataMigration feature is currently disabled, chrome is experimenting it with via field trial. Do we plan to enable it separately for main ?

8000

@MarshallOfSound
Copy link
Member Author

@deepak1556 My plan was to pick it up when Chrome flipped it to ENABLED_BY_DEFAULT. Folks with the ability to toggle flags remotely like field trials (we have that capability) can also run there own rollouts if they choose. I wouldn't want to roll this out before Chrome has it at 100%

Copy link
Contributor
@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

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

The Windows code calls SystemNetworkContextManager::IsNetworkSandboxEnabled() which is implemented in chrome/browser/net/system_network_context_manager.cc, I don't think we can simply include that file to build since it seems to have lots of dependencies.

lld-link: error: undefined symbol: public: static bool __cdecl SystemNetworkContextManager::IsNetworkSandboxEnabled(void)
>>> referenced by .\..\..\chrome\browser\browser_features.cc:99

As a workaround you can probably just define it somewhere in Electron.

#if defined(OS_WIN)
bool SystemNetworkContextManager::IsNetworkSandboxEnabled() {
    auto* local_state = g_browser_process->local_state();
  if (local_state &&
      local_state->HasPrefPath(prefs::kNetworkServiceSandboxEnabled)) {
    return local_state->GetBoolean(prefs::kNetworkServiceSandboxEnabled);
  }
  return sandbox::policy::features::IsNetworkSandboxEnabled();
}
#endif

@deepak1556
Copy link
Member
deepak1556 commented Nov 10, 2021

We maintain a synonymous version of SystemNetworkContextManager https://github.com/electron/electron/blob/main/shell/browser/net/system_network_context_manager.h where it can be defined normally.

But this one would be a special case, as we are building //chrome/browser/browser_features.h in the //chromium_src:chrome target which is set to static_library and not source_set, we would need to define these under //electron/chromium_src and not inside //electron.

Another way would be declare //chrome/browser/browser_features.h as part of //electron target and then we can define stuff inside //electron. This would better for long term, since there has been ongoing work to remove source copies from //electron/chromium_src and now we are down to just the build file, the next step was to merge it to our main build file eliminating chromium_src directory (@miniak is working on it)

Copy link
Member
@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

I'm just here to provide that critically-needed fifth approval

Copy link
Member
@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

Windows fails to build

@MarshallOfSound MarshallOfSound dismissed jkleinsc’s stale review November 15, 2021 19:29

CI will be fixed, don't want to leave this blocked

@trop
Copy link
Contributor
trop bot commented Nov 15, 2021

@VerteDinde has manually backported this PR to "16-x-y", please check out #31852

@VerteDinde VerteDinde merged commit 246884c into main Nov 15, 2021
@VerteDinde VerteDinde deleted the fix-network-paths branch November 15, 2021 23:26
@release-clerk
Copy link
release-clerk bot commented Nov 15, 2021

Release Notes Persisted

~/.config/{App Name} will no longer be incorrectly deleted if it is a symlink on unix systems

@trop
Copy link
Contributor
trop bot commented Nov 15, 2021

I was unable to backport this PR to "16-x-y" cleanly;
you will need to perform this backport manually.

t57ser pushed a commit to t57ser/electron that referenced this pull request Jan 25, 2022
* fix: provide paths for all NetworkContextFilePaths keys

* chore: include chrome features header

* chore: build browser_features

* yolo

* add pref service

* fix: include sandbox policy features

* fix pref key

* fix: gate pref key to OS_WIN

Co-authored-by: VerteDinde <khammond@slack-corp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast-track 🚅 Indicates that this PR is intended to bypass the 24 hour rule. Needs approval from Releases semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0