-
Notifications
You must be signed in to change notification settings - Fork 965
[iOS] Use Chromium web embedder (CWVWebView
)
#24657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
chromium_src/ios/web_view/internal/webui/web_view_web_ui_provider.mm
Outdated
Show resolved
Hide resolved
common_flags = [ "-fapplication-extension" ] | ||
cflags_objc = common_flags | ||
cflags_objcc = common_flags | ||
defines = [ "CWV_IMPLEMENTATION" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be redefined for cwv_exports.h
to properly export the symbols since we're copying public headers as-is
9cf323a
to
0817eb4
Compare
if webView.fullscreenState == .inFullscreen || webView.fullscreenState == .enteringFullscreen { | ||
webView.closeAllMediaPresentations { | ||
self.present(alertController, animated: true) | ||
} | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done by chromium already https://source.chromium.org/chromium/chromium/src/+/main:ios/web/web_state/ui/crw_wk_ui_handler.mm;l=124
6ccffe6
to
66895b3
Compare
patches/ios-web_view-internal-cwv_web_view_configuration.mm.patch
Outdated
Show resolved
Hide resolved
patches/ios-web_view-internal-cwv_web_view_configuration.mm.patch
Outdated
Show resolved
Hide resolved
ios/web_view/web_view_sources.gni
Outdated
|
||
# This file exposes the //ios/web_view embedder as a regular source_set | ||
|
||
ios_web_view_public_headers = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this different from ios_web_view_public_headers
in ios/web_view/BUILD.gn
? If so it would be better to use +=
/-=
instead of duplicating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parts under our own 1 extra public header aren't different but since the original list is defined in a GN file and not GNI I couldn't access them to add into our framework so for now it was duped. If its possible to get to let me know!
4be9903
to
0231609
Compare
042c989
to
39840e8
Compare
88bbb98
to
95bc4df
Compare
ea8aff5
to
2015fc1
Compare
2015fc1
to
6a622e6
Compare
… and buttons not working.
6a622e6
to
775031c
Compare
@bridiver @stoletheminerals could you guys prioritize reviewing this in the near future? It's been in limbo for quite a while 😄 |
|
||
namespace brave { | ||
|
||
// FIXME: Replace patch + override with WKWebViewConfigurationProviderObserver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WKWebViewConfigurationProviderObserver
has actually been removed from Chromium at some point, so will need an alternative "proper" fix
try? await AsyncFileManager.default.removeItem(at: url) | ||
let proposedFilenameWithoutExtension = "\(filenameWithoutExtension) (\(count))" | ||
proposedPath = downloadsPath.appending(path: proposedFilenameWithoutExtension) | ||
.appending(path: fileExtension) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be fixed same way as https://github.com/brave/brave-core/pull/26865/files
I don't want to barge in here with unreasonable demands, specially because there's a lot of work here, but this is PR is too large. Can this work be broken apart into smaller changes? I don't want to be insensitive about authors time, but I'm incredulous we can have accurate reviews of work of this scale. |
@cdesouza-chromium unfortunately there isn't a great way to break this up that would help with reviewing. This PR consists of:
Even if I pulled out the top part into its own PR it would still be a lot of code to review, and additionally would be impossible to test without the other 2 bits anyways |
I think we have a problem in Brave that needs some better approach for these cases. Changes this large do not occur in upstream Chromium. They'll simply refuse to review. The way these types of changes are handled is that you have a deprecation/migration/deletion pathway where things slowly get delivered, but this requires us to change the way we approach code changes. |
@cdesouza-chromium yeah we mostly build things until they're done before making a PR instead of introducing several sub-issues that progressively build towards an end goal. iOS is also a bit trickier to test because we currently can't run unit tests from core in the iOS build due to how we export a framework thats imported by the iOS app (can't even export test code because of As for this PR, if we really want to deem this un-reviewable in its current state, I can create a sub-issues for each "part" to split up but it'll take a bit of work to split it up nicely and inevitably there will still be one or two larger PRs due to the nature of the project and i'll likely need to set up some sort of shell UI to test things per PR |
Well, now I feel bad, because it feels unfair to impose such a demand all of a sudden, for something you've worked hard, and you had no such requirement. We can potentially review this, but we have a few draw backs. now:
Again, I'm not sure what is the best course here, and maybe we should take the punch with this large PR and proceed with it now that it is here while no formal guidelines on this exist (which I'm working on draft for), because it does seems unfair to demand this all of a sudden (better to ask forgiveness than permission and all that), but I think it would be good to raise awareness going forward. |
Well this PR has been open for a long time and has gone back and forth on a numerous implementation details since then so mostly my goal is to get it over the finish line 🙂 If splitting it up will do that then I can take a whack at it, there's just no promises that the end result will be any easier to review 😅 |
It is quite large which makes it very hard to review, but also not sure if breaking it up will make it easier to review. I'll take a look and see if there are parts that make sense to split up. Possibly splitting the chromium changes from the brave-ios changes? |
|
||
namespace prefs { | ||
// A boolean specifying whether HTTPS Upgrades are enabled. | ||
inline constexpr char kHttpsUpgradesEnabled[] = "ios.https_upgrades_enabled"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we normally wouldn't put this kind of stuff in a chromium_src override, but it appears that we're doing that quite a bit already in ios. We shouldn't use chromium_src overrides as a replacement for brave code that should go under ios. So for instance above in BraveRegisterBrowserStatePrefs
should really go in ios/brave/browser/shared/model/prefs/browser_prefs.mm
and same here.
@cdesouza-chromium @bridiver @stoletheminerals |
Resolves brave/brave-browser#38667
Running list:
Needs Migration
WKWebView.interactionState
, need to drop it or ignore it while restoringCWVWebView
and vice-versa.HttpsUpgradeAllowlist
when clearing browser historyBroken Features
getInternalRedirect
, loading a new request before cancelling an active load) on pages that fail to load in the end hit DCHECK (e.g.http://api.segment.io
will get upgraded tohttps
but the link itself is blocked by PiHole/content blockers)CWVWebViewConfiguration
teardown needs to be added to WebMainPartsBugs
target=_blank
but debounce breaks this)https://1password.com/downloads/mac
)http
websites hits aDCHECK
(Chromium bug)Cosmetic Issues
Product Changes
Accesses WebKit
These access
-[CWVWebView(Extras) underlyingWebView]
or-[CWVWebView(Extras) WKConfiguration]
directly and should be migrated over if possibleweb::BrowserState::GetCookieManager()
that may be a replacementFontSizeTabHelper
as a replacement but it's worseloadHTMLString
), only exposed for testing in ChromiumCleanup
CWVWebView
New Feature Support
These will get follow-up issues and can be implemented after this merges
Security Checklist
TBD