chore: bump chromium to 138.0.7175.0 (main) (#46986)

* chore: bump chromium in DEPS to 138.0.7166.0

* chore: bump chromium in DEPS to 138.0.7166.2

* 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

https://chromium-review.googlesource.com/c/chromium/src/+/6508373

* 6470924: Introduce auto-populated Search Engine icons.

https://chromium-review.googlesource.com/c/chromium/src/+/6470924

* 6502977: Force same tab navigation while actor coordinator is acting on a tab

https://chromium-review.googlesource.com/c/chromium/src/+/6502977

* chore: bump chromium in DEPS to 138.0.7168.0

* chore: update patches

* fix grit patch

* chore: bump Chromium to 138.0.7169.2

* fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

* 6493688: NavigationThrottleRunner2: void CreateThrottlesForNavigation

https://chromium-review.googlesource.com/c/chromium/src/+/6493688

* 6488755: Reland "WebSQL: Remove WebPreference"

https://chromium-review.googlesource.com/c/chromium/src/+/6488755

* 6428707: FSA: Only normalize the hardcoded rules once during initialization

https://chromium-review.googlesource.com/c/chromium/src/+/6428707

* chore: fixup patch indices

* chore: bump chromium in DEPS to 138.0.7170.0

* 6514121: Remove origin calculation debug info and related methods

 https://chromium-review.googlesource.com/c/chromium/src/+/6514121

* chore: bump chromium in DEPS to 138.0.7172.0

* chore: bump chromium in DEPS to 138.0.7173.0

* chore: bump chromium in DEPS to 138.0.7175.0

* fixup! 6514121: Remove origin calculation debug info and related methods

Refs https://chromium-review.googlesource.com/c/chromium/src/+/6514121

* 6531585: Don't retry LayerTreeSink creation on the high priority queue

Refs https://chromium-review.googlesource.com/c/chromium/src/+/6531585

* 6512253: Modernize base::apple's base bundle ID

Refs https://chromium-review.googlesource.com/c/chromium/src/+/6512253

* fixup! 6428707: FSA: Only normalize the hardcoded rules once during initialization

Refs https://chromium-review.googlesource.com/c/chromium/src/+/6428707

* fixup! 6508373: Add WebContents, Tab getters for future Clank navigation capture rework

Refs https://chromium-review.googlesource.com/c/chromium/src/+/6508373

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
electron-roller[bot]
2025-05-13 14:51:20 -04:00
committed by GitHub
parent 7ab032f594
commit e3e647d21e
62 changed files with 818 additions and 630 deletions

View File

@@ -76,7 +76,7 @@ void ElectronMainDelegate::SetUpBundleOverrides() {
NSString* team_id = [bundle objectForInfoDictionaryKey:@"ElectronTeamID"];
if (team_id)
base_bundle_id = base::SysNSStringToUTF8(team_id) + "." + base_bundle_id;
base::apple::SetBaseBundleID(base_bundle_id.c_str());
base::apple::SetBaseBundleIDOverride(base_bundle_id);
}
}

View File

@@ -1172,6 +1172,7 @@ void WebContents::WebContentsCreatedWithFullParams(
}
bool WebContents::IsWebContentsCreationOverridden(
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,

View File

@@ -488,6 +488,7 @@ class WebContents final : public ExclusiveAccessContext,
// content::WebContentsDelegate:
bool IsWebContentsCreationOverridden(
content::RenderFrameHost* opener,
content::SiteInstance* source_site_instance,
content::mojom::WindowContainerType window_container_type,
const GURL& opener_url,

View File

@@ -412,7 +412,6 @@ void ElectronBrowserClient::OverrideWebPreferences(
prefs->javascript_can_access_clipboard = false;
prefs->allow_scripts_to_close_windows = true;
prefs->local_storage_enabled = true;
prefs->databases_enabled = true;
prefs->allow_universal_access_from_file_urls =
electron::fuses::IsGrantFileProtocolExtraPrivilegesEnabled();
prefs->allow_file_access_from_file_urls =
@@ -953,26 +952,23 @@ bool ElectronBrowserClient::HandleExternalProtocol(
return true;
}
std::vector<std::unique_ptr<content::NavigationThrottle>>
ElectronBrowserClient::CreateThrottlesForNavigation(
void ElectronBrowserClient::CreateThrottlesForNavigation(
content::NavigationThrottleRegistry& registry) {
std::vector<std::unique_ptr<content::NavigationThrottle>> throttles;
content::NavigationHandle* handle = &registry.GetNavigationHandle();
throttles.push_back(std::make_unique<ElectronNavigationThrottle>(handle));
registry.MaybeAddThrottle(
std::make_unique<ElectronNavigationThrottle>(handle));
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
throttles.push_back(
registry.MaybeAddThrottle(
std::make_unique<extensions::ExtensionNavigationThrottle>(handle));
#endif
#if BUILDFLAG(ENABLE_PDF_VIEWER)
throttles.push_back(std::make_unique<PDFIFrameNavigationThrottle>(handle));
throttles.push_back(std::make_unique<pdf::PdfNavigationThrottle>(
registry.MaybeAddThrottle(
std::make_unique<PDFIFrameNavigationThrottle>(handle));
registry.MaybeAddThrottle(std::make_unique<pdf::PdfNavigationThrottle>(
handle, std::make_unique<ChromePdfStreamDelegate>()));
#endif
return throttles;
}
content::MediaObserver* ElectronBrowserClient::GetMediaObserver() {

View File

@@ -76,8 +76,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
base::OnceCallback<void(bool, bool)> callback);
// content::NavigatorDelegate
std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(
void CreateThrottlesForNavigation(
content::NavigationThrottleRegistry& registry) override;
// content::ContentBrowserClient:

View File

@@ -10,6 +10,7 @@
#include "base/base_paths.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/json/values_util.h"
#include "base/path_service.h"
#include "base/task/bind_post_task.h"
@@ -39,6 +40,16 @@
#include "ui/base/l10n/l10n_util.h"
#include "url/origin.h"
ChromeFileSystemAccessPermissionContext::BlockPathRules::BlockPathRules() =
default;
ChromeFileSystemAccessPermissionContext::BlockPathRules::~BlockPathRules() =
default;
ChromeFileSystemAccessPermissionContext::BlockPathRules::BlockPathRules(
const BlockPathRules& other) = default;
ChromeFileSystemAccessPermissionContext::BlockPathRules&
ChromeFileSystemAccessPermissionContext::BlockPathRules::operator=(
const BlockPathRules& other) = default;
namespace gin {
template <>
@@ -141,51 +152,53 @@ bool MaybeIsLocalUNCPath(const base::FilePath& path) {
}
#endif // BUILDFLAG(IS_WIN)
// Describes a rule for blocking a directory, which can be constructed
// dynamically (based on state) or statically (from kBlockedPaths).
struct BlockPathRule {
base::FilePath path;
BlockType type;
};
bool ShouldBlockAccessToPath(const base::FilePath& path,
HandleType handle_type,
std::vector<BlockPathRule> rules) {
bool ShouldBlockAccessToPath(
base::FilePath path,
HandleType handle_type,
std::vector<ChromeFileSystemAccessPermissionContext::BlockPathRule>
extra_rules,
ChromeFileSystemAccessPermissionContext::BlockPathRules block_path_rules) {
DCHECK(!path.empty());
DCHECK(path.IsAbsolute());
path = ChromeFileSystemAccessPermissionContext::NormalizeFilePath(path);
for (auto& rule : extra_rules) {
rule.path =
ChromeFileSystemAccessPermissionContext::NormalizeFilePath(rule.path);
}
#if BUILDFLAG(IS_WIN)
// On Windows, local UNC paths are rejected, as UNC path can be written in a
// way that can bypass the blocklist.
if (MaybeIsLocalUNCPath(path))
if (MaybeIsLocalUNCPath(path)) {
return true;
#endif // BUILDFLAG(IS_WIN)
// Add the hard-coded rules to the dynamic rules.
for (auto const& [key, rule_path, type] :
ChromeFileSystemAccessPermissionContext::GenerateBlockedPath()) {
if (key == ChromeFileSystemAccessPermissionContext::kNoBasePathKey) {
rules.emplace_back(base::FilePath{rule_path}, type);
} else if (base::FilePath block_path;
base::PathService::Get(key, &block_path)) {
rules.emplace_back(rule_path ? block_path.Append(rule_path) : block_path,
type);
}
}
#endif
base::FilePath nearest_ancestor;
BlockType nearest_ancestor_block_type = BlockType::kDontBlockChildren;
for (const auto& block : rules) {
if (path == block.path || path.IsParent(block.path)) {
DLOG(INFO) << "Blocking access to " << path
<< " because it is a parent of " << block.path;
auto should_block_with_rule = [&](const base::FilePath& block_path,
BlockType block_type) -> bool {
if (path == block_path || path.IsParent(block_path)) {
VLOG(1) << "Blocking access to " << path << " because it is a parent of "
<< block_path;
return true;
}
if (block.path.IsParent(path) &&
(nearest_ancestor.empty() || nearest_ancestor.IsParent(block.path))) {
nearest_ancestor = block.path;
nearest_ancestor_block_type = block.type;
if (block_path.IsParent(path) &&
(nearest_ancestor.empty() || nearest_ancestor.IsParent(block_path))) {
nearest_ancestor = block_path;
nearest_ancestor_block_type = block_type;
}
return false;
};
for (const auto* block_rules_ptr :
{&extra_rules, &block_path_rules.block_path_rules_}) {
for (const auto& block : *block_rules_ptr) {
if (should_block_with_rule(block.path, block.type)) {
return true;
}
}
}
@@ -193,6 +206,8 @@ bool ShouldBlockAccessToPath(const base::FilePath& path,
// nearest ancestor does not block access to its children. Grant access.
if (nearest_ancestor.empty() ||
nearest_ancestor_block_type == BlockType::kDontBlockChildren) {
VLOG(1) << "Not blocking access to " << path << " because it is inside "
<< nearest_ancestor << " and it's kDontBlockChildren";
return false;
}
@@ -200,12 +215,14 @@ bool ShouldBlockAccessToPath(const base::FilePath& path,
// access to directories. Grant access.
if (handle_type == HandleType::kFile &&
nearest_ancestor_block_type == BlockType::kBlockNestedDirectories) {
VLOG(1) << "Not blocking access to " << path << " because it is inside "
<< nearest_ancestor << " and it's kBlockNestedDirectories";
return false;
}
// The nearest ancestor blocks access to its children, so block access.
DLOG(INFO) << "Blocking access to " << path << " because it is inside "
<< nearest_ancestor;
VLOG(1) << "Blocking access to " << path << " because it is inside "
<< nearest_ancestor << " and it's kBlockAllChildren";
return true;
}
@@ -446,11 +463,30 @@ FileSystemAccessPermissionContext::FileSystemAccessPermissionContext(
const base::Clock* clock)
: browser_context_(browser_context), clock_(clock) {
DETACH_FROM_SEQUENCE(sequence_checker_);
ResetBlockPaths();
}
FileSystemAccessPermissionContext::~FileSystemAccessPermissionContext() =
default;
void FileSystemAccessPermissionContext::ResetBlockPaths() {
is_block_path_rules_init_complete_ = false;
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(
&ChromeFileSystemAccessPermissionContext::GenerateBlockPaths, true),
base::BindOnce(&FileSystemAccessPermissionContext::UpdateBlockPaths,
weak_factory_.GetWeakPtr()));
}
void FileSystemAccessPermissionContext::UpdateBlockPaths(
std::unique_ptr<ChromeFileSystemAccessPermissionContext::BlockPathRules>
block_path_rules) {
block_path_rules_ = std::move(block_path_rules);
is_block_path_rules_init_complete_ = true;
block_rules_check_callbacks_.Notify(*block_path_rules_.get());
}
scoped_refptr<content::FileSystemAccessPermissionGrant>
FileSystemAccessPermissionContext::GetReadPermissionGrant(
const url::Origin& origin,
@@ -604,12 +640,26 @@ void FileSystemAccessPermissionContext::ConfirmSensitiveEntryAccess(
std::move(after_blocklist_check_callback));
}
void FileSystemAccessPermissionContext::CheckShouldBlockAccessToPathAndReply(
base::FilePath path,
HandleType handle_type,
std::vector<ChromeFileSystemAccessPermissionContext::BlockPathRule>
extra_rules,
base::OnceCallback<void(bool)> callback,
ChromeFileSystemAccessPermissionContext::BlockPathRules block_path_rules) {
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(&ShouldBlockAccessToPath, path, handle_type, extra_rules,
block_path_rules),
std::move(callback));
}
void FileSystemAccessPermissionContext::CheckPathAgainstBlocklist(
const content::PathInfo& path_info,
HandleType handle_type,
base::OnceCallback<void(bool)> callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// TODO(https://crbug.com/1009970): Figure out what external paths should be
// TODO(crbug.com/40101272): Figure out what external paths should be
// blocked. We could resolve the external path to a local path, and check for
// blocked directories based on that, but that doesn't work well. Instead we
// should have a separate Chrome OS only code path to block for example the
@@ -619,15 +669,27 @@ void FileSystemAccessPermissionContext::CheckPathAgainstBlocklist(
return;
}
std::vector<BlockPathRule> extra_rules;
extra_rules.emplace_back(browser_context_->GetPath().DirName(),
BlockType::kBlockAllChildren);
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(&ShouldBlockAccessToPath, path_info.path, handle_type,
extra_rules),
std::move(callback));
// Unlike the DIR_USER_DATA check, this handles the --user-data-dir override.
// We check for the user data dir in two different ways: directly, via the
// profile manager, where it exists (it does not in unit tests), and via the
// profile's directory, assuming the profile dir is a child of the user data
// dir.
std::vector<ChromeFileSystemAccessPermissionContext::BlockPathRule>
extra_rules;
if (is_block_path_rules_init_complete_) {
// The rules initialization is completed, we can just post the task to a
// anonymous blocking traits.
CheckShouldBlockAccessToPathAndReply(path_info.path, handle_type,
extra_rules, std::move(callback),
*block_path_rules_.get());
return;
}
// The check must be performed after the rules initialization is done.
block_rules_check_subscription_.push_back(block_rules_check_callbacks_.Add(
base::BindOnce(&FileSystemAccessPermissionContext::
CheckShouldBlockAccessToPathAndReply,
weak_factory_.GetWeakPtr(), path_info.path, handle_type,
extra_rules, std::move(callback))));
}
void FileSystemAccessPermissionContext::PerformAfterWriteChecks(

View File

@@ -12,13 +12,14 @@
#include <string>
#include <vector>
#include "base/callback_list.h"
#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/values.h"
#include "chrome/browser/file_system_access/chrome_file_system_access_permission_context.h" // nogncheck
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/file_system_access_permission_context.h"
class GURL;
@@ -135,6 +136,14 @@ class FileSystemAccessPermissionContext
void PermissionGrantDestroyed(PermissionGrantImpl* grant);
void CheckShouldBlockAccessToPathAndReply(
base::FilePath path,
HandleType handle_type,
std::vector<ChromeFileSystemAccessPermissionContext::BlockPathRule>
extra_rules,
base::OnceCallback<void(bool)> callback,
ChromeFileSystemAccessPermissionContext::BlockPathRules block_path_rules);
void CheckPathAgainstBlocklist(const content::PathInfo& path,
HandleType handle_type,
base::OnceCallback<void(bool)> callback);
@@ -159,6 +168,11 @@ class FileSystemAccessPermissionContext
const base::FilePath& path,
GrantType grant_type) const;
void ResetBlockPaths();
void UpdateBlockPaths(
std::unique_ptr<ChromeFileSystemAccessPermissionContext::BlockPathRules>
block_path_rules);
base::WeakPtr<FileSystemAccessPermissionContext> GetWeakPtr();
const raw_ptr<content::BrowserContext, DanglingUntriaged> browser_context_;
@@ -176,6 +190,14 @@ class FileSystemAccessPermissionContext
std::map<base::FilePath, base::OnceCallback<void(SensitiveEntryResult)>>
callback_map_;
std::unique_ptr<ChromeFileSystemAccessPermissionContext::BlockPathRules>
block_path_rules_;
bool is_block_path_rules_init_complete_ = false;
std::vector<base::CallbackListSubscription> block_rules_check_subscription_;
base::OnceCallbackList<void(
ChromeFileSystemAccessPermissionContext::BlockPathRules)>
block_rules_check_callbacks_;
base::WeakPtrFactory<FileSystemAccessPermissionContext> weak_factory_{this};
};