622 Commits
Author SHA1 Message Date
r0hit0303 c16b4ec7fe [fingerprinting] Handle device info leaks for WebGPU (#36817)
This change scrubs the device related info from GPUAdapterInfo namely vendor, architecture and device.

This change adds a patch to the upstream gpu_adapter.cc to intercept right before the moment we create the gpu adapter info, to scrub out these attributes. It was not possible to do it in gpu_adapter_info.cc as it lacked any context around ExecutionContext which was needed to get the farbling level.

Below are the final behaviour with different farbling levels after this change:

Farbling "off"
- No change in behaviour i.e no scrubbing will occur.
Farbling "balanced" with WebGLBalancedFingerprintingProtection enabled
- Scrub the device related info from GPUAdapterInfo.
Farbling "balanced" with WebGLBalancedFingerprintingProtection disabled
- No change in behaviour i.e no scrubbing will occur.
Farbling "maximum":
- Scrub the device related info from GPUAdapterInfo. Note that this is a new behaviour and not to tied to any feature flag. For maximum farbling it makes sense to have the maximum protection.

Resolves brave/brave-browser#55677
2026-05-29 17:56:20 +01:00
vadims 6af6e79b8d [PSST] Add consent dialog UI (#36529)
Added failed consent dialog state to handle cases where applying privacy
settings fails midway through the process and async handling
to the policy script, along with additional browser tests to cover it.

Resolves: https://github.com/brave/brave-browser/issues/55649
---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
2026-05-21 11:11:50 +02:00
Pavel Beloborodov e3527b9759 Added New Email Alias suggestion into autofill popup. (#34516)
* Added New Email Alias suggestion into autofill popup.
2026-04-30 10:31:18 +07:00
Anthony Tseng 9df0bef8ab Reland "[AI Chat] Support text file uploads with renderer-based extraction"" (#35613)
Revert "Revert "[AI Chat] Support text file uploads with renderer-based extra…"

This reverts commit c0e4f7effd.
2026-04-17 12:06:01 -07:00
Darnell Andries 0a7437712c Ignore unknown attribute names in P3A manifest (#35421)
* Ignore unknown attribute names in P3A manifest

* Address PR feedback
2026-04-17 11:37:33 -07:00
Anthony Tseng c0e4f7effd Revert "[AI Chat] Support text file uploads with renderer-based extraction" (#35582)
Revert "[AI Chat] Support text file uploads with renderer-based extraction (#…"

This reverts commit 0a0068baf7.
2026-04-16 17:53:48 +01:00
Anthony Tseng 0a0068baf7 [AI Chat] Support text file uploads with renderer-based extraction (#35305)
* [AI Chat] Add kText file type and ProcessTextFile mojom interface

Add kText to UploadedFileType enum and ProcessTextFile method to
AIChatUIHandler for upcoming text file upload support. Include iOS
no-op implementation.

* [AI Chat] Add TextFileExtractor for text file upload

Add TextFileExtractor subclass of FileTextExtractorBase that extracts
text via document.body.innerText after loading the file in a hidden
WebContents. The renderer handles MIME sniffing and encoding detection.

* [AI Chat] Add text file type detection and unfiltered file picker

Treat all non-image/non-PDF files as text (kText), letting the
renderer handle MIME sniffing — matching how Chromium's
Browser::OpenFile works. Remove extension-based file picker filtering.

* [AI Chat] Integrate TextFileExtractor into page handler

Add ProcessTextFile mojo endpoint implementation and text extraction
in the file picker upload flow. Text files from the file picker are
extracted via TextFileExtractor after PDF extraction completes.

* [AI Chat] Add text file content blocks for LLM engine

Handle kText uploaded files in BuildOAIMessages by sending extracted
text as TextContentBlock with "[File: filename]" prefix, following
the same pattern as PDF text extraction.

* [AI Chat] Add frontend support for text file uploads

Accept all files in drag-and-drop and paste. Handle non-image/non-PDF
files as text via processTextFile mojo call. Treat kText as document
type for upload limits. Display text files with file icon.

* [AI Chat] Add unit tests for text file type detection

Update AcceptedFileExtensions test for unfiltered file picker.
Add tests for text file handling: known extension (.txt),
extensionless files, and unknown extensions (.diff).

* [AI Chat] Show alert when files cannot be read as text

Show an error alert via Leo AlertCenter when uploaded files are
dropped because the renderer could not extract text from them
(e.g. binary files, unsupported formats).

* [AI Chat] Move ExtractText overloads to FileTextExtractorBase

Both PdfTextExtractor and TextFileExtractor had identical
ExtractText implementations. Move both the file-path and
file-bytes overloads to the base class. PdfTextExtractor
keeps a convenience overload that passes "pdf" as extension.

* [AI Chat] Unify PDF and text file extraction into a single flow

Use one barrier callback and one extractors_ vector instead of
separate pdf_extractors_/text_extractors_ and chained extraction
passes. This removes duplicated scanning, barrier setup, and
per-file callback logic.
2026-04-15 21:11:01 +01:00
Pavel Beloborodov 0c285e3920 Fixed possible html injection in speedreader. (#34778)
* Using AppendText instead of raw strings manipulation.
2026-03-25 11:39:34 +07:00
Anthony Tseng 3500adf3bc Re-Enable Screen AI features and ai_chat pdf ocr integration (#34457)
* Revert "Disable Screen AI accessibility features"

This reverts commit 6d237a5923.

* Revert "Disable screen_ai component download/installation (#26167)"

This reverts commit 27b10ae93a.

Print preview tests from the original commit are not re-added because
they were independently removed by b13af2e384 ("Unify Print Preview
extraction across all desktop platforms") which changed the architecture
to use autoscreenshots for docs.google.com hosts.

UpstreamPDFIntegratoinTest is not re-added because the API it uses
(GetPageContent, features::kPdfOcr, accessibility tree) no longer exists.
New OCR tests are added in the next commit using the current architecture.

chromium_src/pdf/pdfium/pdfium_page.cc is not re-added because
https://chromium-review.googlesource.com/c/chromium/src/+/6854968
handles it upstream.

* Add PDF OCR browsertests for image-only PDFs

Test extraction via PDFDocumentHelper::GetPageText() for:
- Single/multi-page image-only PDFs (upstream test data)
- Image PDFs with blank pages (brave test data)

Also adds PrintPreviewHostReturnsEmpty test to verify that
docs.google.com hosts return empty content (autoscreenshots).
2026-03-05 22:44:50 +00:00
Netzenbot f2ad0c1142 Fix flaky AIChatRenderViewContextMenuBrowserTest.RewriteInPlace_InputText (#34118)
The wait_for_text() JavaScript function in rewrite.html used only a
MutationObserver to detect text changes. MutationObserver observes DOM
node mutations (childList, subtree, characterData) but does NOT observe
.value property changes on <input> and <textarea> elements. When the
Replace() IPC updates an input element's value asynchronously, the
MutationObserver never fires, causing EvalJs to time out.

Add an 'input' event listener alongside the MutationObserver so that
value changes on form elements are properly detected. MutationObserver
continues to handle contenteditable elements. A resolved flag prevents
duplicate resolution.

Resolves brave/brave-browser#53073
2026-02-23 19:06:53 -05:00
Mikhail 367be052ab Fix some eslint js issues (#33856)
The PR fixes eslint issues in *.js files and removes the related rules from the backlist.
2026-02-14 22:10:28 +04:00
Jocelyn Liu 6e27d8be77 [AI Chat] Fix flaky RewriteInPlace_ContentEditable test (#33632)
Fix flaky RewriteInPlace_ContentEditable test

Two issues were causing flakiness:

1. Focus issue: For contenteditable elements, the test was selecting
   text without focusing the element first. This caused params_.is_editable
   to sometimes be false, preventing GenerateRewriteSuggestion from being
   called. Fixed by adding element.focus() before selection in rewrite.html.

2. DOM timing issue: The Replace() IPC updates the DOM asynchronously,
   but the test was checking immediately after the completion callback.
   Fixed by using a MutationObserver to wait for the DOM to update to
   the expected value before verifying.

   The MutationObserver pattern follows the approach used in Chromium's
   service_worker_internals_ui_browsertest.cc.

Resolves brave/brave-browser#52417
2026-02-04 02:00:01 +00:00
Brian R. Bondy 638f571834 Fix Tor intermittent failures (#33301)
* Use universal binary for Tor tests

The test data binary at brave/test/data/tor/components/mac/cldoidikboihgcjfkhdeidbpclkineef/1.0.0/tor-0.3.3.8-darwin-brave-5 is x86_64 only.
But the component is a universal binary: cldoidikboihgcjfkhdeidbpclkineef
Tor tests BraveTorBrowserTest and BraveTorWithCustomProfileBrowserTest are failing with EBADARCH.

* Ensure component cleanup finishes before test exits

When PRE_ResetBridges sets bridges to not used, it triggers cleanup of the pluggable transport component. The test was only waiting for the snowflake process to exit (WaitProcessExit), but the component cleanup happens asynchronously on a separate thread
2026-01-21 10:05:53 -05:00
Kevin Smith 69f1018a32 [Rewards] Do not show onboarding success modal (#32874) 2025-12-18 11:23:29 -05:00
Pavel Beloborodov ff84987d54 Added New Email Alias context menu item. (#32322)
* Added New Email Alias context menu item.
2025-11-20 16:32:04 +07:00
Aleksei Khoroshilov f488494374 Support StoragePartitionConfig setting on WebContents creation. (#31761) 2025-11-11 17:24:48 +07:00
Emerick Rogul b489bdd50d [cr142] Fix timing issue in BraveWindowNameBrowserTest.SameOrigin browser test
`BraveWindowNameBrowserTest.SameOrigin` loads a document that rus a script that
sets `window.location.href` to a new URL. Since the script is in `<head>` it may
run before the initial navigation is fully committed. Blink therefore saw the
previous document in a pre-commit state where its `SecurityOrigin` was still
opaque. When it compared origins, they didn't match due to that perceived
difference and `window.name` was erroneously cleared.

Instead of this, we set `location.href` once the document has finished loading.
Then the same-origin check won't fail.
2025-10-15 20:31:30 -04:00
cdesouza-chromium daef249ec0 [CodeHealth] Replace ternary ops with logical expressions (#31558)
This PR is part of a couple of changes correcting these redundant
ternary operations:

```
x ? y : false -> x && y
x ? false : y -> !x && y
x ? y : true - > !x || y
x ? true : y -> x || y
```

This PR mirrors upstream work being done in the same direction:
https://issues.chromium.org/issues/416294715

Bug: https://github.com/brave/brave-browser/issues/49819
2025-10-01 21:17:34 +01:00
Brian R. Bondy 720533d115 Fix WebAudio farbling test timing issue (#31079)
The test was checking document.title before the async WebAudio operations completed.
Changed it to await the promise resolution instead of an immediate title check.
2025-09-08 15:23:26 -04:00
Pavel Beloborodov bcd76c1a46 Extensions MV2 settings backup. (#30268)
* Added extensions mv2 settings backup.

Added ExtensionsManifectV2Migrator which observes webstore extensions. When it detects certain extension is disabled by unsupported manifest version reason, it stores the Local Extension Settings and IndexedDB settings to ExtensionsMV2Backup directory in the browser profile.

Boolean feature param import_settings [requires backup_settings to be enabled]:
If enabled, ExtensionsManifectV2Migrator observes the brave-hosted extensions installation events. When brave-hosted extension in installed and there is the settings backup then ExtensionsManifectV2Migrator imports settings to the newly installed extension.
2025-08-27 17:56:53 +07:00
Anthony Tseng b13af2e384 Unify Print Preview extraction across all desktop platforms (#30632) 2025-08-21 03:31:34 +09:00
Mihai PLESA f2deccb789 community.brave.app migration (#30622)
* community.brave.app migration
2025-08-13 18:00:12 +01:00
Jakub Wądołowski be8e54c8bb chore: Update support domain name (#29625)
* chore: Update support domain name

* fix: Resolve formatting issue reported by CI

* chore: Conflict resolution

* fix: Update support.brave.com ref
2025-08-11 22:09:03 +01:00
vadims c1933020e0 Refactoring of the PSST feature
It is first stage of the PSST feature implementation. The main goal
was to make the existing code ready to the next implementation
steps and be consistent with feature requirements.

Resolves: https://github.com/brave/brave-browser/issues/46045

---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
2025-07-23 21:45:51 +02:00
Anton Lazarev 64672cb019 Support :matches-css*(...) regexes (#30214)
* support regexes in :matches-css*(...) procedural operators

* add test for matches-css regex values
2025-07-23 02:07:54 +02:00
Anton Lazarev 741aa2a4ab Use literal values from matches attr and matches prop (#30114)
* treat :matches-attr() and :matches-prop() args literally if not regex

* add test cases that shouldn't be hidden
2025-07-22 12:03:21 -07:00
Simone Arpe 6e1791f50c Add PIP icon in omnibox (#29431) 2025-07-17 21:17:54 +02:00
Anton Lazarev 21439940fe add test for matches-attr without value 2025-07-15 20:53:03 -07:00
Anton Paymyshev 0d6991ce5b Move wallet tests to brave_components_unittests (#29971)
Move wallet tests to brave_components_unittets
2025-07-11 21:10:58 +07:00
Anthony Tseng 47b9bbd7ad Create component unit tests (#29739)
Create brave_components_unittests so components tests don't run as part of ChromeTestSuite
2025-07-01 15:21:58 -07:00
Jay Harris 880a11345e [lit mangler]: Support patching .html files (#29622) 2025-06-26 15:03:09 +12:00
Anthony Tsengandbridiver 29d8cb29f0 Fix unresponsive youtube transcript fetching (#29619)
* Use InnerTube API to fetch caption tracks as ytplayer method now
gives us empty content when fetching from its content url.
It also fixes unresponsive content fetching due to callback will never be
called when xml parsing failed.

* Fix AIChatBrowserTest.YoutubeNavigations

* Add ParseYoutubeTranscriptXml util function along with unit tests

* Remove AIChatResourceSniffer along with old YT <transcript> xml handling

* Add missing PageContentExtractorRenderViewTest

* Enforce browser/ai_chat runtime data files deps

* Add support for separate components unit test exe

* add brave_components_unittests ci feature

* Add missing PageContentFetcherTest

* URLEncoded InnerTube API key

* Make components/ai_chat/core/common/yt_util.h as non-public API

* Add validations for YT video id and innertube API key

* Disable brave_components_unittests becasuse it failed on Android test
runner. We will re-enable it in a seperate PR.

---------

Co-authored-by: bridiver <34129+bridiver@users.noreply.github.com>
2025-06-24 23:20:52 +02:00
Brian Clifton cfa161e90d Remove the web torrent code from brave-core (#29320)
* Remove the web torrent code from brave-core

Fixes https://github.com/brave/brave-browser/issues/46430

Includes manual adjustment for `resources/resource_ids.spec`
2025-06-24 19:11:59 +02:00
Pavel Beloborodov 5d797e6c18 Add support for installing Brave's packed extensions. (#28757)
* Added support for installing Brave's packed extensions.
* Added installer for mv2 extensions.
* Added Brave's public key to check verified_contents.json metadata for extension.
2025-06-10 13:38:37 -07:00
Max Karolinskiy f53cb20d4f Updates support links. (#29355) 2025-06-04 06:44:37 -07:00
Anthony Tseng e1f47e3266 Check column existence in MigrateFrom3to4 and fix incorrect test database dump data (#29362) 2025-06-03 12:00:37 -07:00
Darnell Andries 73dfa9206d Metric configuration via component updater 2025-05-30 13:14:26 -07:00
Jay Harris d9d45aa013 [AI Chat]: Remove TextEmbedder (#28874) 2025-05-29 14:31:24 +12:00
StephenHeaps 81935db0e9 fix(privacy): Procedural filters matching against dynamically added child elements (#29139)
* For procedural filtering, check child nodes when failing to match root element to the selector.

* Add browser test for element with child procedural filter match.

* Add iOS test for element with child procedural filter match.

* Remove outdated procedural filters script sync comment after landing https://github.com/brave/brave-browser/issues/43262.
2025-05-25 14:23:50 -04:00
Anton Lazarev 467799e745 Merge pull request #29195 from brave/matches-path-non-latin-characters
Support non-latin characters in `:matches-path`
2025-05-23 14:46:25 -07:00
Brian R. Bondy 1174a90b46 Remove Ethereum Remote Client (Crypto Wallets) (#29135)
There was a flag from long ago that allowed you to select Crypto Wallets as your wallet. However if you did this, it no longer works.  There is no one that can feasibly still be using this wallet because it hasn't worked for many versions

Addressed review comments

Remove references to 21070F3D60711361C1210B870439BE49B5D995F4
21070F3D60711361C1210B870439BE49B5D995F4 is for Ethereum Remote Client which is removed

Remove unused ReinstallAsNonComponent

Remove unused comment IsInstallationExplicitlyAllowed

Remove _permission_features.json because it's an override that only
exists because of CW extension.

Remove unused string braveWalletImportFromLegacy

Use constexpr for kMetamaskExtensionId

Remove need subscription to kDefaultEthereumWallet and OnWalletTypeChanged handler

Remove DISABLED_ImportLegacyWallet

Add Migration for people with CryptoWallets pref

Deprecate and keep CryptoWallets prefs

1
2025-05-23 16:56:41 -04:00
Anton Lazarev eded7f1027 support non-latin characters in matches-path 2025-05-22 21:49:40 -07:00
Jocelyn Liu e733b8f78f [Leo] Support RegenerateAnswer with different model and add an automatic model (#28999) 2025-05-14 09:46:24 +02:00
Terry Mancey e0f1214e61 [ads] Sandbox ImageNTT assets to prevent path traversal (#28902) 2025-05-12 10:56:47 -05:00
Simone Arpeandbridiver dba6298f0d Inject JS script to restore picture in picture behavior (#28593)
Implements a strategy to bring back picture in picture support for YouTube videos.
Picture in picture implementation is behind feature flag `kBravePictureInPictureForYouTubeVideos` enabled by default.

Test coverage has been extensively discussed and introduced to make sure:

- We don't have race conditions when injecting the JS script
- We don't inject the script multiple times on same page navigation
- We don't create side effects in case of unexpected changes, and/or serialzed flags don't match
- We inject/modify the serialized flags in case of partial match

---------

Co-authored-by: bridiver <34129+bridiver@users.noreply.github.com>
2025-05-06 15:14:15 +02:00
Pavel Beloborodov d058914122 Importing settings for extension from indexed db source. (#28189)
* Importing settings for extension from indexed db source.
* Added dialog to notify user about the source profile in use.
* Fixed UI state not update properly on import start.
2025-05-03 20:13:48 +07:00
Simon Hong 9950428329 Try to fix crash while importing password (#28803)
fix https://github.com/brave/brave-browser/issues/45603

Some users got crash while importing password from MS-edge.
According to the crash log, it happened when importing password
form that blocked by user but username or password are not empty.
Not sure how this happened in MS-edge's password store.

Fix this by not importing invalid blocked forms.
2025-04-25 08:09:29 +09:00
Anthony Tseng e753813227 [AI Chat] Full page screenshots feature (#28714) 2025-04-22 18:10:01 -07:00
Anton Paymyshev c3275fe3f2 Cardano transactions core support (#28462) 2025-04-17 09:30:13 +07:00
Brian R. Bondy e19aac5f48 Increase associated content lengths and handle content receipts (#27630)
* Increase associated content lengths

Mixtral -> 8x increase

Llama -> 8x increase

Qwen -> 8x increase

* Add trimmed tokens warning

For now this only appears after the first message and it updates over
time on that first message. So the warning could show for example that
it could only use 65% of tokens, then later change to 62% after
subsequent messages.

* Store has_trimmed_tokens in database

With DB migration to v3
2025-03-25 16:47:59 -04:00