This change adds a helper class `RandomizedMessageHandlerName` that can be used in JavaScriptFeature's to support randomizing message handler names. The randomized message handler is a UUIDv4 which is injected with the script itself via placeholder replacement.
This adds an additional tokenized method `sendWebKitMessageSynchronously` alongside `sendTokenizedWebKitMessage{WithReply}` that uses `window.prompt` from SafeBuiltins.
This change adds a helper class `MessageHandlerToken` that can be used in JavaScriptFeature's to support tokenized communication validation. The token is a UUIDv4 which is injected with the script itself via placeholder replacement. Given the sensitivity of the token
Upstream's `webView:startURLSchemeTask:` now rejects any WebUI sub-resource
whose `SchemeHostPort` differs from the main `webView.URL` unless it is
served from `chrome://resources`. That breaks Brave's per-frame `WebUIIOS`
support (04db68e84d), where a trusted WebUI page deliberately embeds a
chrome-untrusted (or sibling-host) WebUI iframe (e.g. AI Chat).
Extend the existing chromium_src override to also admit any URL recognized
by a registered `WebUIIOSControllerFactory`. Non-WebUI URLs continue to
fall through to the upstream check, preserving its hardening intent.
Fixes the `WebUITest.LoadWebUIPageWithWebUIChildFrame` integration test.
Note: AI-assisted: requires thorough review
Chromium changes:
https://source.chromium.org/chromium/chromium/src/+/6b67808f449e4e6ebfd00182dcf09c7a37bb75b9
commit 6b67808f449e4e6ebfd00182dcf09c7a37bb75b9
Author: Mike Dougherty <michaeldo@chromium.org>
Date: Mon Apr 27 02:18:09 2026 -0700
Correctly pass WebUI headers to resource response
This CL forwards headers set on URLRequestChromeJob instances inside
URLDataManagerIOSBackend to the actual response. Previously these
headers were unintentionally discarded.
Although set_add_content_security_policy is being explicitly disabled in
this CL, it represents no change in behavior because the header was not
previously forwarded to the response.
Bug: 502503860
Change-Id: I85b33794a405bf132b094c47e890df0473c1b591
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7764734
Auto-Submit: Mike Dougherty <michaeldo@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1620954}
This adds a base JavaScriptFeature for accessing safe builtins in Brave JS features that require it based on the code in `__firefox__.js`. The main difference here is that this PR only focuses on the builtins (Object, Function, Array) needed for Web3 scripts and does not handle any `toString` overrides (which were only needed for tokenized communication)
This change fixes an intermittent CI failure when running iOS `WebTestSuite` tests which expect a resource.pak to always be part of the suite bundle by ensuring the packed resources are always copied into the target even in `ios_brave_web_unittests` where there are no explicit resources required to run the tests at the moment
This migration has been effected in upstream, but several places in our
codebase got broken by this transition. This change makes several parts
of our codebase more friendly to passing `string_view`.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/0e1784e3cf990560b173f40338e582f50aba0e85
commit 0e1784e3cf990560b173f40338e582f50aba0e85
Author: Charlie Harrison <csharrison@chromium.org>
Date: Fri Oct 3 11:04:26 2025 -0700
RELAND: Migrate GURL::path() and friends to return string_view
This relands crrev.com/c/7003625. Missing cases were found by staring
at the output of `git grep` for the whole codebase.
Origin description:
Also migrates some last remaining callers of the std::string APIs.
This completes phase 1 of crbug.com/448174617.
Bug: 448174617
Change-Id: I7f24f81d1fbf129d8b0dd94f4cf948626deab933
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7007010
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1524878}
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/49fd9fee7984636d2325e8110566f34b3c9bd0c6
commit 49fd9fee7984636d2325e8110566f34b3c9bd0c6
Author: Greg Thompson <grt@chromium.org>
Date: Wed Sep 10 08:28:38 2025 -0700
[ios] Only load locale pak files in Chrome tests
Non-Chrome tests do not have locale pak files, so they should load only
the test-only resources.pak file. This change moves loading of locales
up into IOSChromeUnitTestSuite (which has and needs them). In so doing,
I found that //ios/web/test:packed_resources was missing a dependency on
//ui/strings:app_locale_settings and that
//ios/components:ios_components_unittests was missing a dependency on
the test-only resources.pak.
Bug: 432395473
Change-Id: Ib10c9cd85d6e9443fa9c20c92f4f095829ce4915
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6769904
Auto-Submit: Greg Thompson <grt@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1513727}
This change replaces WebState's `*WebUI` related methods with ones that allow storing a set of WebUI's such that WebUI's can create child frames that also load WebUI which can be necessary for untrusted frames.
This ensures that if a frame can't be found with the given id it falls back to the main frame so that mojo can handle the callback correctly even if it will error later.
This change adds the frame ID for the facade handling mojo communications calls so that it may execute responses on the correct frame. This is a requirement for WebUI that may have child frames that also use mojo binding.
* Refactor WebUI Utils for iOS
* Refactor Ads and Skus for iOS to use the new WebUI Utils
* Add favicon_source for iOS
* add sanitized_image_source for iOS
* Add untrusted_sanitized_image_source for iOS