We need to manually add a ChromeExtensionWebContentsObserver to the
WebView's WebContents now that the |enable_extension_apis| parameter
is gone from the constructor, which we used to set to |true| causing
the BubbleContentsWrapper to do it for us.
Chromium change:
https://github.com/chromium/chromium/commit/183029096a06ae326108700c8f6272c6cec9b174
commit 183029096a06ae326108700c8f6272c6cec9b174
Author: Lukasz Anforowicz <lukasza@chromium.org>
Date: Tue Nov 16 19:45:05 2021 +0000
Introduce ContentBrowserClient::AttachUniversalWebContentsObservers.
Problem description
===================
Before this CL, there was a discrepancy in how Chrome Extensions were
handled in the Browser process VS the Renderer processes:
1. Code in a Renderer process ensures that content scripts are injected
into *all* elligible documents (ones with URLs that match patterns
requested by an extension). This Renderer-side code is agnostic to
whether the document is in a browser tab or in a different flavor of
WebContents.
This universal applicability of content scripts is desirable - if a
user installs an extension to modify certain documents (e.g. change
the behavior of https://example.com) then such user intent should be
respected in all WebContents hosting such documents.
2. Code in the Browser process would create ExtensionWebContentsObserver
(EWCO) only for some, but not for all WebContents. This was because
when creating a new flavour of WebContents it was possible to miss
the responsibility to construct EWCO - we've identified multiple
WebContents flavours were EWCO was missing.
The discrepancy between the Browser and the Rednderer processes would
mean that some content scripts are injected but:
A. They cannot talk to extensions::mojom::LocalFrameHost (which is
bound by EWCO::BindLocalFrameHost) and therefore extension API calls
do not work
B. They are not recognized by ContentScriptTracker (which relies on
notifications like EWCO::ReadyToCommitNavigation). This was
responsible for majority of DumpWithoutCrashing reports tracked in
https://crbug.com/1212918.
Changes in this CL
==================
This CL adds a new method to ContentBrowserClient -
AttachUniversalWebContentsObservers (which gets called by the //content
layer for every WebContents after it gets created and initialized).
Implementation of the new method in ChromeContentBrowserClient
constructs ChromeExtensionWebContentsObserver for each WebContents.
For more background (and discussion of alternative approaches for
addressing the problem) please see the document here:
https://docs.google.com/document/d/1zITHyso0axNdAZV3qySgsoWW-p6jOEKbWqoVJbOW92c/edit?usp=sharing
Bug: 1212918
The NavigatorPluginsFixed feature is now unconditionally enabled, so
we need to add some extra code to make sure that we always rely on
Brave's farbling mechanism, instead of returning upstream's fixed
plugins data.
Chromium change:
https://github.com/chromium/chromium/commit/c2abba012946a341b479821594eccaf45c893b3f
commit c2abba012946a341b479821594eccaf45c893b3f
Author: Mason Freed <masonf@chromium.org>
Date: Tue Nov 16 00:38:55 2021 +0000
Remove the NavigatorPluginsFixed feature flag
This feature shipped successfully in M94, with no reported bugs.
As such, this CL removes the feature flags. Note that the various
uses of |should_return_fixed_plugin_data_| need to stay, as they
are still used to re-enable the dynamic plugin lists for apps,
which is controlled via:
GetSettings()->GetAllowNonEmptyNavigatorPlugins()
until at least June, 2022.
Bug: 1171373,1164635
Chromium changes:
https://chromium.googlesource.com/chromium/src.git/+/fbeeb1c228427bcc94d22747210309b99f88c0b1
commit fbeeb1c228427bcc94d22747210309b99f88c0b1
Author: Gabriel Charette <gab@chromium.org>
Date: Wed Nov 10 20:50:06 2021 +0000
[content] Make ContentMainParams and MainFunctionParams move-only
This is taking care of a long-standing TODO to move these OnceClosure
holders rather than copy them around with their OnceClosure* members.
This is a precursor to
https://chromium-review.googlesource.com/c/chromium/src/+/3187153/35#message-fcc92e9f85e73f0e5ba6c03610a95cda8736f1f9
which highlighted a problem where some tests see a non-null
MainFunctionParams::ui_task but running the closure results in a UAF.
Logs show that the test hitting the UAF is not the one setting this
field. This CL makes that impossible and fixes the issue in the
follow-up CL.
This CL is intended to be a logical no-op.
This CL touches a lot of files and must happen all at once.
The core change is that ContentMainParams and MainFunctionParams's
moveable fields (ui_task, created_main_parts_closure, and startup_data)
are now held by moveable types rather than raw pointers.
This trickles in the following chain:
main() (in various *_main.cc)
(or SetUp() in !OS_ANDROID browser_test_base.cc)
-> ContentMain()
-> ContentMainRunnerImpl::Initialize()
(forwards arg into MainFunctionParams)
-> RunBrowser()
-> BrowserMain()
-> BrowserMainRunnerImpl::Initialize()
-> BrowserMainLoop (stores MainFunctionParams)
-> BrowserMainLoop::Init
-> ContentBrowserClient::CreateBrowserMainParts()
-> (Embedder)ContentBrowserClient::CreateBrowserMainParts()
-> (Embedder)BrowserMainParts(Platform)
-> (Embedder)BrowserMainParts
-> RunOtherNamedProcessTypeMain()
-> (Embedder)ContentMainDelegate::RunProcess()
(or)
-> FooMain() (kMainFunctions)
(or)
-> RunZygote()
(creates its own MainFunctionParams)
-> (Embedder)ContentMainDelegate::RunProcess()
(on OS_ANDROID, browser_test_base.cc calls directly into
ContentMainDelegate::RunProcess())
Few of these needed the params after passing them down so a move-only
model was simple to adapt (even if invasive). The few exceptions like
BrowserMainRunnerImpl::Initialize consuming |created_main_parts_closure|
are better off in the new model (where they take the OnceClosure before
passing down the params) because that prevents others down the chain
from having access to a OnceClosure they shouldn't invoke anyways.
Noteworthy:
- ContentMainDelegate::RunProcess():
Returned an exit_code >= 0 to indicate the embedder elected to handle
the run request given these params. With move-only semantics it is
necessary to return the params back when the embedder declines
handling this run request. An absl::variant return value is used
to satisfy this requirement.
- content/public/test/test_launcher.h : GetContentMainParams():
Becomes CopyContentMainParams() and only exposes a copy of copyable
params. Uses new ContentMainParams::ShallowCopyForTesting() which
verifies that moveable fields are still null by that time as should be
the case in the order browser tests are initialized.
- MainFunctionParams::command_line being const& violated the style-guide
rule to "avoid defining functions that require a const reference
parameter to outlive the call". This also prevented moving. The type
was hence switched to a const CommandLine*.
- BUILD.gn changes for nacl_helper_win_64 which requires static linking
of its minimal //content deps (was previously missing a dep but was
getting away with it because MainFunctionParams was .h only; required
now with .cc). This was already done for static_switches and this CL
adds static_main_function_params, reusing a similar static_features
target that already existed but was no longer required in
/c/nacl/broker, cleaning that up by replacing rather than copying that
target's definition in this CL.
- ContentMainParams::minimal_browser_mode was weirdly passed as a
parameter to ContentMainRunner::Run(bool start_minimal_browser) but
that method also has access to the ContentMainParams originally passed
via ContentMainRunner::Init(). Passing the param again from Run()
would be a use-after-move in content_main.cc, instead
content_main_runner_impl.cc was updated to use the param it already
has in store.
Bug: 1175074
Only a couple of files really need to include this header now to use
ignore_result(), and we can just drop the include from everywhere else.
Chromium changes:
https://chromium.googlesource.com/chromium/src.git/+/2e6be1400ab678f21d871d0d3a1199912967324fhttps://chromium.googlesource.com/chromium/src.git/+/5666ff4f5077a7e2f72902f3a95f5d553ea0d88dhttps://chromium.googlesource.com/chromium/src.git/+/3a3f9436142e712d4a7e2a962d85154876fa395f
commit 2e6be1400ab678f21d871d0d3a1199912967324f
Author: Peter Boström <pbos@chromium.org>
Date: Sat Nov 13 01:28:25 2021 +0000
Rename "base/macros.h" => "base/ignore_result.h"
This file only contains ignore_result() and is no longer a collection of
macros.
This change fixes a couple of missing IWYU removals as well.
Bug: 1010217
commit 5666ff4f5077a7e2f72902f3a95f5d553ea0d88d
Author: Peter Boström <pbos@chromium.org>
Date: Fri Nov 12 03:40:24 2021 +0000
Remove most remaining unused "base/macros.h"
Removes `#include "base/macros.h"` from remaining .cc, .h and .mm files
that do not contain `ignore_result(` and do not trigger pre-commit or
pre-upload errors.
Bug: 1010217
commit 3a3f9436142e712d4a7e2a962d85154876fa395f
Author: Peter Boström <pbos@chromium.org>
Date: Mon Nov 8 21:04:37 2021 +0000
Add #include "base/macros.h" for ignore_result()
This fixes IWYU for existing instances of ignore_result() to make
removal of #include "base/macros.h" from files using it for DISALLOW_*
macros easier.
Bug: 1010217
This target is no longer in the public_deps for //ui/base, so we need
to explicitly list it now to avoid link errors.
Chromium change:
https://chromium.googlesource.com/chromium/src.git/+/2b98feda0cb0ef000c2f41d3f729cf7189bf394b
commit 2b98feda0cb0ef000c2f41d3f729cf7189bf394b
Author: Maksim Sisov <msisov@igalia.com>
Date: Fri Nov 5 16:22:03 2021 +0000
ozone: //ui/base: clean up from USE_X11 1/*
This is another CL that removes USE_X11 define and
gn arg usage from //ui/base and also removes
IsUsingOzonePlatform condition as it's no longer
needed as it always resolves to true.
Please note that //ui/base used to have
//ui/base/x in public_deps. That resulted in other
components implicitly depending on the //ui/base/x
as well. However, after it was deleted, it was
required to fix deps in //remoting/host,
//components/viz/service and //chrome/test/chromedriver.
Changes:
1) Moved hit_tests_x11 to //ui/platform_window/x11
2) Moved os_exhange_data_provider_x11 to //ui/platform_window/x11
3) Fixed deps
4) //ui/base:ui_base_unittests no longer includes //ui/base/x:unittests.
Instead, the //ui/base/x:unittests target is included in
//ui/platform_window/x11:x11_unittests and these base x11 unittests
run as part of x11_unittests.
Bug: 1096425
- introducing `upholdCustomerDueDiligenceRequiredModal` that tells the user to complete the CDD survey on Uphold
- parsing out `verifications.customerDueDiligence.status` from the response of `GET https://api.uphold.com/v0/me`
- sending the user to `NOT_CONNECTED`/`DISCONNECTED_VERIFIED` if CDD is required for them
- and showing `upholdCustomerDueDiligenceRequiredModal` (and `kWalletDisconnected` if already VERIFIED)
- adding test cases
This should have no effect since all (or most) existing users would be migrated with the last 2 major releases and now only new users would be affected
As reported in https://github.com/brave/brave-browser/issues/20501,
the NTP was making outbound requests to ftx.com at startup without
user opt-in, and the network-audit didn't catch that case because
it was NOT loading a NTP as part of the different checks it does
at BraveNetworkAuditTest.BasicTests.
This patch adds explicit test coverage for that case by loading
brave://newtab and waiting 5 minutes, like with the other checks.
Resolves https://github.com/brave/brave-browser/issues/20504
- more clear variable names for cargo.gni
- remove `cxx-build` as a dep from browsers/rs cargo.toml
- remove deprecated friend usage in SkusServiceFactory
- Proper null check in GetForContext (SkusServiceFactory)
- renaming PageController => JSHandler
- fixing guard usage (leaving TODOs where work required)
- pref_names split into 2 files
- BraveVpnServiceDesktop now gets passed pending remote and binds
- SKU mojom ref in VPN (desktop) will now rebind if connection broken
- Updated comments (documentation)
- Fixed callback usage in SkusServiceImpl
- Fixed gn_check violations
- Default SKU feature to true on iOS
- Have a common preferences registration (avoid iOS duplicating)