18 Commits
Author SHA1 Message Date
Kyle Hickinson 7726cd762a [iOS] Opt-in to prettier for iOS typescript/markdown (#36998) 2026-06-04 20:53:52 -04:00
Kyle Hickinson 6c47850c0b [iOS] Add support for randomized message handlers in JavaScriptFeatures (#36371)
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.
2026-06-03 15:16:40 -04:00
Kyle Hickinson 798e46c6a7 [iOS] Add methods for sending tokenized prompts to the browser (#36855)
This adds an additional tokenized method `sendWebKitMessageSynchronously` alongside `sendTokenizedWebKitMessage{WithReply}` that uses `window.prompt` from SafeBuiltins.
2026-06-03 09:18:29 -04:00
Kyle Hickinson e400d7b93c [iOS] Add support for token validation in JavaScriptFeatures (#36853)
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
2026-06-02 10:34:45 -04:00
Jay Harris 859131ea58 [csp]: Remove option to disable trusted types (#36805) 2026-05-28 06:37:24 +01:00
Emerick Rogul 2bad3ba722 [cr149] Permit cross-host WebUI iframes in CRWWebUISchemeHandler
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}
2026-05-22 16:57:39 -04:00
Kyle Hickinson 779110a2b6 [iOS] Add safe builtins JavaScript feature (#35629)
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)
2026-04-22 10:41:47 -04:00
Kyle Hickinson 7bec1511f7 [iOS] Always copy test resources into both web test targets (#33044)
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
2026-01-07 11:06:57 -05:00
Emerick Rogul e6fe5289ce [cr143] Use string_view with URLDataSourceIOS virtuals
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/003db4099ba936170d6ece6c4f7215603418919c

commit 003db4099ba936170d6ece6c4f7215603418919c
Author: Claudio DeSouza <cdesouza@chromium.org>
Date:   Mon Oct 20 20:16:45 2025 -0700

    Use `string_view with `URLDataSourceIOS` virtuals

    This change is being made in order to make these virtuals more friendly
    towards GURL, which now returns `string_view` values for things like
    `path()`.

    Bug: 448174617
    Change-Id: I9d8211e6abaf364c8422b32a8c907465eeccef8a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7059214
    Reviewed-by: Mike Dougherty <michaeldo@chromium.org>
    Commit-Queue: Claudio DeSouza <cdesouza@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1532710}
2025-11-18 11:27:17 -05:00
Claudio DeSouza 51604f40d0 [cr143] Several GURL methods returning string_view
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}
2025-11-18 11:18:41 -05:00
StephenHeaps f3b3b1418f [iOS] Network Connection Integrity not compiled into Nightly (#31943)
Remove build flags for network connection integrity & use obfuscated Swift selector.
2025-10-22 13:42:01 -04:00
Emerick Rogul 7fb770eafd [cr142][ios] Ensure appropriate pak file loaded in web tests
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}
2025-10-15 20:31:07 -04:00
StephenHeaps c607480d34 [iOS] Network Connection Integrity (#31410)
Add feature flag (default off) to enable WebKit Advanced Privacy Protections in Nightly iOS.
2025-10-02 15:39:56 -04:00
Kyle Hickinson 04db68e84d [iOS] Support per-frame WebUI's in WebState (#31259)
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.
2025-09-20 02:36:20 +09:00
Kyle Hickinson 393be6e426 [iOS] Add main frame fallback for mojo facade watcher callback (#31265)
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.
2025-09-18 09:36:55 -04:00
Kyle Hickinson 377dca3a3a [iOS] Handle multiple frames correctly in MojoFacade (#31184)
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.
2025-09-15 12:48:33 -04:00
Brandon-T 8b62c7a648 [iOS] - Update WebUI Sharable code + Add FaviconSource & Image Sources (#30887)
* 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
2025-09-03 12:49:53 -04:00
Brandon-T 57b7d93b7d [iOS] - Refactor WebUI iOS code datasources to match Chromium structure (#29904)
* Move //brave/ios/browser/ui/webui data-sources to //brave/ios/web/webui as it is in Chromium
2025-07-16 22:43:29 +02:00