* Disable flaky Chromium test SocketApiTest.SocketTCPExtension
Re-add filter entry for SocketApiTest.SocketTCPExtension that was
lost during a Chromium version update. This is an upstream Chromium
test (chrome/browser/extensions/api/socket/socket_apitest.cc) with a
known flakiness rate of 5.8% in LUCI Analysis (30-day lookback,
83,121 verdicts). Already disabled on Windows by Chromium
(crbug.com/1319604). Brave has no chromium_src overrides in the
socket API path.
The test intermittently fails in testPendingCallback because TCP
read() returns partial data (HTTP headers only) when the response
arrives in multiple segments — the test incorrectly assumes a single
read returns the complete response.
Resolves https://github.com/brave/brave-browser/issues/54922
* Add inline comment for SocketApiTest filter entry
The deferred kNodeCreated notification (posted via PostTask in
AddTreeTabNode) can fire while the tab strip model and views are out
of sync. On macOS, Cocoa event loop pumping during pin/move operations
can deliver the posted task before views have been updated, causing
tab_at(index) to access an index beyond the view count.
Add a bounds check against the tab strip's view count so the handler
gracefully skips when views haven't caught up with the model.
Resolves https://github.com/brave/brave-browser/issues/54541
The upstream Chromium test BrowserContextDestructionVsCookieRemoval
flakes because document.cookie (set via JavaScript in the renderer)
uses a different Mojo pipe than GetAllCookies (queried from the browser
via CookieManager), with no ordering guarantee between the two.
Brave amplifies this from the upstream ~0.6 % rate because Ephemeral
Storage forces every cookie operation through IPC (disabling Chromium's
cookie cache optimization in CookieJar::IPCNeeded).
Add a chromium_src override for browsing_data_test_util.cc that calls
HasDataForType after SetDataForType. For cookies this forces a
round-trip through RestrictedCookieManager → CookieStore, serialising
with the prior SetCanonicalCookieAsync on the same CookieMonster task
runner and guaranteeing the cookie is committed before any subsequent
GetAllCookies query.
The BrowserContextDestructionVsCookieRemoval test has a separate issue:
BlockUntilCompletion() never returns after the incognito profile is
destroyed during data removal. CookieIncognitoDeletion also hangs in
incognito mode. Both remain disabled in the filter file.
Resolvesbrave/brave-browser#54537
The test intermittently failed with "deepQuery is not defined" because
InjectHelpers() could execute on the bubble's WebContents before its
WebUI page (chrome://email-aliases.panel/) had finished loading. When
the WebUI document committed after injection, the JavaScript context
was replaced and deepQuery was lost.
Add WaitForLoadStop() in InjectHelpers() to ensure the target
WebContents has finished loading before injecting helper functions.
This matches the pattern used by brave_wallet_tab_helper_browsertest.
Resolvesbrave/brave-browser#54889
Upstream Chromium test with 1.0% flake rate (182K verdicts over 30 days
per LUCI Analysis). Root cause is FindNewCheckTime() scheduling past
Now()+interval due to LocalMidnight() timezone boundary. Already
filtered on Linux. No Brave chromium_src overrides affect scheduling.
Resolves https://github.com/brave/brave-browser/issues/54960
Disable Chromium test ServiceWorkerIdTrackingBrowserTest.WorkerNotStalledInStopping_RemovedByRenderStopNotificationFirst on MSan
The upstream test captures a const reference to a ServiceWorkerRunningInfo
map entry, stops the service worker (removing the entry), then reads from
the now-dangling reference. MSan correctly detects this use-after-free.
The bug does not manifest in non-sanitizer builds because the freed memory
typically still contains valid data.
Stable upstream: 0.2% flake rate over 30 days (LUCI Analysis).
No Brave modifications in chrome/browser/extensions/ for this file.
Resolves https://github.com/brave/brave-browser/issues/54959
* [BraveSync] Migrate from os_crypt/sync to async
Starting from cr149 components/os_crypt/sync will be
removed completely in a favor of components/os_crypt/async.
Resolves https://github.com/brave/brave-browser/issues/55192
Add best practice: Use *.mojom-forward.h in headers
CS-070: prefer the auto-generated *.mojom-forward.h over the full
*.mojom.h bindings when a header only references mojom types as
pointers, references, or function parameters. Reduces compile times
and transitive dependencies.
Source: PR #35622 review comment by netzenbot.
Hides the "Show New Tab Page Ads" toggle and the
"Learn more about new tab page ads" link in
Settings -> New Tab Page when Brave Rewards is disabled by policy.
Both controls remain visible and functional otherwise.
Also switches BackgroundImagesPreferences to retrieve the profile via
the inherited getProfile() instead of the legacy
ProfileManager.getLastUsedRegularProfile().
Resolves: https://github.com/brave/brave-browser/issues/55312
[VPN 2.0] BoringTun 3p dependency: license information.
This is a multi-part change to add BoringTun dependency to the brave-core, to be used later in the VPN 2.0 architecture by a privileged helper on desktop OSes. The dependency is added to the existing VPN to ensure it actually gets built with the browser, but not yet distributed.
Part 3: license information for Boringtun and its dependencies needed by Brave build system. Created a custom script to generate the necessary licensing information (README.chromium, and combined license files where appropriate) and put that information directly into the "brave/third-party/vendor" directory. The script should be re-run on updating the vendored crates.
Adds ARCH-072 to docs/best-practices/architecture.md. A KeyedServiceFactory
may only return nullptr based on session-stable attributes (profile type,
buildflags, base::Feature). Gating creation on user-toggleable prefs forces
restarts and was repeatedly flagged in PR reviews.
* Bridge web frames manager observer through Tab abstraction layer
- make brave_web_view conform CRWWebFramesManagerObserver
- add BraveWebFrame wrapper exposing web::WebFrame state to Swift
- notify BraveWebViewNavigationDelegate when a web frame becomes available
- propagate frameDidBecomeAvailable through TabObserver/TabState
* review(kyle): address feedback
* nit changes
1. rename brave_web_frame internal header file
2. add brave_web_frame_internal.h in gn file
3. other nit udpates
* fix typo
* [Origin] Wait for all policy managers before refreshing profile policies
`BraveProfilePolicyProvider` observes both `BraveOriginPolicyManager`
and `AdBlockOnlyModePolicyManager`. Each fires `OnBravePoliciesReady`
independently, so the first notification could call `RefreshPolicies`
before the other manager's `Init()` had run -- producing a bundle that
reflected only one source and flipping `IsFirstPolicyLoadComplete` true
on the empty load.
Introduce `BravePolicyManagerBase` with self-registration and a static
`AllInitialized()`. `OnBravePoliciesReady` early-returns until every
registered manager reports ready; `policies_ready_` is gated on the
same check so `SetProfileID` can't trigger a partial refresh either.
Future managers inheriting from the base are picked up automatically.
Resolves: https://github.com/brave/brave-browser/issues/55276
This PR introduces support for `cr mv` and `cr follow-renames` to
correct `gn` references across the projects when a `BUILD.gn` path
changes. This is a modest introduction to references path correction.
The rewrite does handle relative references though. In source references
are only corrected for the main target, i.e `:basename`, which gets
corrected to the new path base name.
This new approach also attempts to correct gn references to moved
sources, but only for `//` root reference paths. In the future we could
potentially introduce some mechanism handles file renames.
The baseline for this feature was to get the following to build with no
errors:
```
git cr mv components/api_request_helper/ components/api_foo
npm run build -- --target=brave:all
```
As a small detour, this PR adds `npm run format` to these commands, when
wrapping up. This PR also adds a README.md for the `alias` folder.
Resolves https://github.com/brave/brave-browser/issues/55297
This change uses a new label for plaster reapply commits, as the
previous name had `Regen` in it, which can cause confusion with the
similar command `brockit regen`.
When we using group APIs in tests, we need to ensure the tab group sync
service is initialized. Otherwise, the service could be initialized
later during shutting down and try to access Browser objects that are
already destroyed.
* Replace model-load barrier with chained base::OneShotEvents
Two signals gate the EmbeddingGemma model load: the component being
installed and the renderer-side PassageEmbedderFactory registering. A
BarrierClosure(2) paired with a component_ready_counted_ flag was
needed because LocalModelsUpdaterState::AddObserver synchronously
re-fires OnLocalModelsReady when install_dir is already set, which
would otherwise tick the barrier twice.
Swap the barrier for two base::OneShotEvents: Signal() is idempotent
under is_signaled(), so the guard flag disappears, and chaining
Post(component_ready)->Post(factory_registered)->LoadLocalModelFiles
expresses the dependency directly.
Addresses:
https://github.com/brave/brave-core/pull/32689#discussion_r3114239143https://github.com/brave/brave-core/pull/32689#discussion_r3113758418
* Use state machine
---------
Co-authored-by: Brian Johnson <34129+bridiver@users.noreply.github.com>
HorizontalTabStripRegionView::UpdateButtonBorders() applies asymmetric
vertical border insets to the new tab button (top > bottom) so the
button's hit area extends to the top of the tab strip. This asymmetry
was introduced in #35778. The upstream ControlButtonHighlightPathGenerator
uses GetContentsBounds() for the hover highlight rect, which is shifted
down by the top inset. However, LabelButton centers its icon within
GetLocalBounds() (ignoring vertical insets), so the highlight and the
icon end up on different vertical centers.
Fix by installing a BraveNewTabButtonHighlightPathGenerator that takes
the highlight rect size from GetContentsBounds() but re-centers it on
GetLocalBounds().CenterPoint(), matching where the icon is drawn.
TEST=BraveNewTabButtonHighlightTest.HighlightVerticalCenterMatchesIcon
Resolvesbrave/brave-browser#55252