Commit Graph
182 Commits
Author SHA1 Message Date
Mario Sanchez Prada bbf5fd3fe9 Remove deprecated DISALLOW_ macros from Brave-specific code
Macros such as DISALLOW_COPY_AND_ASSIGN() are deprecated since r711900
per style arbitration [1]. This commit replaces the macros with deleted
constructors and methods, which is preferred by the Google C++ Style
Guide [2][3].

Also remove unneeded "base/macros.h" #includes when possible.

This CL is created semi-mechanically with remove_disallow and
remove_base_macros [4].

[1]: https://groups.google.com/a/chromium.org/g/cxx/c/qwH2hxaEjac/m/TUKq6eqfCwAJ
[2]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
[3]: https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types
[4]: https://pkg.go.dev/go.timothygu.me/tools/cr/cmd

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/d002a3bee7ae75780b604d17df19291a3dd303fb

commit d002a3bee7ae75780b604d17df19291a3dd303fb
Author: Peter Boström <pbos@chromium.org>
Date:   Fri Nov 5 17:17:19 2021 +0000

    Remove DISALLOW_ macros from base/macros.h

    This removes DISALLOW_COPY(), DISALLOW_ASSIGN() and
    DISALLOW_COPY_AND_ASSIGN() from base/macros.h. PRESUBMITs are also
    updated to no longer check for these macros.

    IWYU removal is left as a separate change just in case this needs to be
    reverted.

    Bug: 1010217
2022-01-24 15:33:37 -05:00
Brian Clifton 9d896aaa5d SimpleURLLoader updates, renaming, and lint fixes
- Update SimpleURLLoader response to pass thru error code and properly handle body
- Update SimpleURLLoader to use `DownloadToStringOfUnboundedSizeUntilCrashAndDie`
  instead of expecting an arbitrary response size
- Renaming and lint fixes
2022-01-13 23:20:56 -07:00
Pete Miller 3aa27059a8 Fixes required after Chromium 97 upgrade 2022-01-13 23:20:56 -07:00
Brian Clifton 7d40f1b6d9 Restrict injection to Brave pages; Add documentation to classes 2022-01-13 23:20:54 -07:00
Brian Clifton 693aecda08 Implement shim_purge / shim_set / shim_get
Adds persistant storage for SKU SDK key/value pairs via profile setting
2022-01-13 23:20:53 -07:00
Brian Clifton cf4f4aefb8 Initial commit for SKU SDK component
Goal is to expose a few SKU SDK methods via render frame observer injection:
- `window.brave.skus.refresh_order`
- `window.brave.skus.fetch_order_credentials`
- `window.brave.skus.prepare_credentials_presentation`
- `window.brave.skus.credential_summary`

If these methods are detected by the JS SDK on the account.brave.com website, they can be
called in lieu of the methods in the JS SDK - providing a way for the credential to be
safetly be intercepted by the browser.

The first use-case for using a credential is with VPN. The VPN credential is read and
then passed through to the vendor.

`brave_content_browser_client` connects the renderer side
(`BraveSkusRenderFrameObserver` and `BraveSkusJSHandler`) to the
implementation (SkusSdkImpl) via mojom bindings (see
`RegisterBrowserInterfaceBindersForFrame`).

The implementation in this commit exposes the `refresh_order` method and
returns a dummy JSON response.
2022-01-13 23:20:53 -07:00
mkarolin 035484715e Disable navigator.connection attribute by default.
Fixes brave/brave-browser#20122
2021-12-23 17:33:02 -05:00
mkarolin a8da7db0dc WebBundleBuilder was merged into web_package.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/e140256d3df3b1cb6c8d2c2d82775f67bc75d172

commit e140256d3df3b1cb6c8d2c2d82775f67bc75d172
Author: Miras Myrzakerey <myrzakereyms@google.com>
Date:   Tue Oct 12 06:49:54 2021 +0000

    Merge WebBundleBuilder between data_decoder:: and web_package::test::

    This CL merges the functionality of a WebBundleBuilder that's used by a
    WebBundler in services/data_decoder and WebBundleBuilder that's used
    for testing in components/web_package/test_support. The resulting
    WebBundleBuilder resides in components/web_package and used everywhere.

    Bug: 1193871
2021-12-07 14:43:09 -05:00
Brian R. Bondy 326599737d Fix high CPU loop from EnsureConnected/Disconnect wallet handlers 2021-11-05 19:45:34 -04:00
Brian R. Bondy c04fe1b7ff Update cpp/.h build flags for wallet 2021-11-03 10:34:27 -04:00
Brian R. Bondy 6a232513e7 Remove wallet buildtime flag brave_wallet_enabled 2021-11-03 10:34:23 -04:00
mkarolin 8aa596d56a FileSystemAccess API feature flag: code review fixes. 2021-11-01 11:14:06 -04:00
mkarolin db5249527f Add a feature flag to allow enabling FileSystemAccess API. 2021-10-29 17:21:53 -04:00
Brian R. Bondy 788395e35f Make window.ethereum non-writable when explicitly specified 2021-10-26 11:00:16 -04:00
Aleksey Seren 6d12cf3fb7 Inject braveRequestAdsEnabled() js function.
fix https://github.com/brave/brave-browser/issues/16964
2021-09-30 01:33:54 +07:00
Anton Lazarev ff223a5176 remove cosmetic filtering extension version 2021-09-07 15:06:30 -07:00
Mario Sanchez Prada d7bdc1c8fa Adapt test expectation to new format of the Javascript error message
The format changed from "Cannot set property '%' of %" to  "Cannot
read properties of % (reading '%')") recently in V8.

This fixes the following browser test:

  * SerialAPIBrowserTest.SerialAPIDisabled

V8 change:

https://chromium.googlesource.com/v8/v8/+/c0fd89c3c089e888c4f4e8582e56db7066fa779b

commit c0fd89c3c089e888c4f4e8582e56db7066fa779b
Author: Patrick Thier <pthier@chromium.org>
Date:   Thu Jun 17 11:15:41 2021 +0000

    Reland "Reland "Reland "Improve error messages for property access on null/undefined"""

    This is a reland of 819c3ae2f87fc7ad634fe4356de6653bb3cb3b87

    Original change's description:
    > Reland "Reland "Improve error messages for property access on null/undefined""
    >
    > This is a reland of 8b18c5e6a534d7c459a16aebdd4fe05133db6dea
    >
    > Original change's description:
    > > Reland "Improve error messages for property access on null/undefined"
    > >
    > > This is a reland of 24c626c1f7809ce725e56152ab2928696a2f8e9e
    > >
    > > Original change's description:
    > > > Improve error messages for property access on null/undefined
    > > >
    > > > Only print the property name when accessing null/undefined if we can
    > > > convert it to a string without causing side effects.
    > > > If we can't, omit the property name in the error message.
    > > > This should avoid confusion when the key is an object with toString().
    > > > E.g. undefined[{toString:()=>'a'}] doesn't print 'read property [object
    > > > Object]' anymore, which was misleading since the property accessed would
    > > > be 'a', but we can't evaluate the key without side effects.
    > > >
    > > > Bug: v8:11365
    > > > Change-Id: If82d1adb42561d4851e2bd2ca297a1c71738aee8
    > > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2960211
    > > > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    > > > Commit-Queue: Patrick Thier <pthier@chromium.org>
    > > > Cr-Commit-Position: refs/heads/master@{#75250}
    > >
    > > Bug: v8:11365
    > > Change-Id: Ie2312337f4f1915faa31528a728d90833d80dbd1
    > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2979599
    > > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    > > Commit-Queue: Patrick Thier <pthier@chromium.org>
    > > Cr-Commit-Position: refs/heads/master@{#75571}
    >
    > Bug: v8:11365
    > Change-Id: I90360641ecd870bd93247aa6d91dfb0ad049cfb8
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3008219
    > Auto-Submit: Patrick Thier <pthier@chromium.org>
    > Commit-Queue: Toon Verwaest <verwaest@chromium.org>
    > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#75604}

    Bug: v8:11365
    Change-Id: I002b537144f328ccbbdcd655e26e5dc87c49c6f5
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3013935
    Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    Commit-Queue: Patrick Thier <pthier@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#75645}
2021-08-18 10:58:36 -04:00
Serg 09be9af475 Adds a mojo disconnect handler to brave wallet and cosmetic filters js handlers 2021-07-15 20:36:36 -04:00
mkarolin 0e7b362863 base::Optional -> absl::optional.
Chromium change:

https://source.chromium.org/chromium/chromium/src/+/2d59e682ab9eb904124f5778eb8ceb3cb2a90231

commit 2d59e682ab9eb904124f5778eb8ceb3cb2a90231
Author: Anton Bikineev <bikineev@chromium.org>
Date:   Tue May 18 12:29:22 2021 +0000

    Deprecate base/optional.h and fix remaining mentions.

    Docs are still to be updated (in a followup).

    Bug: 1202909

Converted remaining cases of base::Optional to absl::optional, plus
updated DEPS file with an exception that is temporarily required
while we don't have such exception added to Chromium's toplevel DEPS
file (see commit linked below, not yet included in 92.0.4503.5).

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/9662571bb2954fb1759c49e5c45e59571cd1899e

commit 9662571bb2954fb1759c49e5c45e59571cd1899e
Author: Anton Bikineev <bikineev@chromium.org>
Date:   Thu May 13 19:17:50 2021 +0000

    Reland "Alias base::Optional to absl::optional"

    This relands f3493eb4f80c5716ed2d7de195f710537beacc6b. The reason of the
    failure: missing base// dep in some of the internal components, which
    caused the branded builds to fail.

    For sherrifs: the change may cause build failures on bots that are not
    tested in the regular CQ pipeline. Those issues are mostly caused by
    missing base// dependencies. Before reverting this change, please
    consider fixing missing dependencies, similar to what the CL 2891488
    does.

    Original CL description:
    > Alias base::Optional to absl::optional
    >
    > This CL does the following:
    > 1) Replaces base::Optional and friends with aliases to corresponding
    > entities from abseil. base::in_place is the only thing not aliased, as
    > it's also used in other contexts (e.g. StructPtr in mojo).
    > 2) Replaces all optional-related uses of base::in_place with
    > absl::in_place.
    > 3) Fixes missing headers (e.g. base/check.h) that used to be recursively
    > included from base/optional.h
    > 4) Also, removes forward declarations for base::Optional and instead
    > includes "base/optional.h" directly. The argument is the same as for
    > forward declarations of std types - the exact declaration (struct vs
    > class, number of template arguments (e.g. for SFINAE)) is an
    > implementation detail that can change.
    >
    > The CL also tries to support base/optional_unittest.cc (will be removed
    > with base/optional.h) however the nocompile is already removed, since
    > supporting it seems to be harder.
    >
    > Followup CLs will replace base::optional with absl::optional per
    > component.
    >
    > Bug: 1202909
    > Change-Id: I25b276401ceba13da35b3a0331d5ccbd338c4539
    > AX-Relnotes: n/a.
    > Reviewed-on:
    > https://chromium-review.googlesource.com/c/chromium/src/+/2892208
    > Commit-Queue: Anton Bikineev <bikineev@chromium.org>
    > Commit-Queue: Peter Kasting <pkasting@chromium.org>
    > Reviewed-by: Peter Kasting <pkasting@chromium.org>
    > Reviewed-by: Kentaro Hara <haraken@chromium.org>
    > Owners-Override: Peter Kasting <pkasting@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#882460}

    Bug: 1202909
2021-06-29 16:35:39 -04:00
Serg 3a0d5c4811 Resets mojo remote and receiver on DidCreateScriptContext as previous frame is not longer valid 2021-06-14 22:42:51 -04:00
Pete Miller 854aa3175e Create JS API for Search to set as default search provider 2021-06-10 12:24:11 -07:00
Serg 4920967f8d Moves connect event right after web3 provider objects creation 2021-05-28 14:31:10 -04:00
Serg cb27b4452c web3 provider connect and chainChanged events 2021-05-28 09:41:45 -04:00
Mario Sanchez Prada 79af4bc963 Replace all usage of base::string16 with std::u16string
The "base/strings/string16.h" file does no longer exist and we need
to remove all remaining usages of that type with the one from the
C++ standard library instead, like Chromium upstream already did.

Also replaces no longer needed ASCIIToUTF16 and UTF8ToUTF16 calls used
with constant strings with `u` string literals.

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/7e1e44476bb361e95dc252d8428324a3feb89ecd

commit 7e1e44476bb361e95dc252d8428324a3feb89ecd
Author: Jan Wilken Dörrie <jdoerrie@chromium.org>
Date:   Sun Mar 14 19:37:05 2021 +0000

    [LSC] Remove base/strings/string16.h

    This change removes base/strings/string16.h and remaining references to
    it from the code base.

    Bug: 1184339
2021-05-05 12:03:20 +02:00
Serg e552bcc279 Merge pull request #8537 from brave/brave_search_tests
Brave search param changes and extra tests
2021-04-16 09:06:34 -04:00
Serg 21f37eaf5f Re-enables brave search browser tests 2021-04-15 14:21:52 -04:00
Francois Marier bfc4cf1ade Avoid explicitly disabling SharedArrayBuffer (fixes brave/brave-browser#14766)
This partially reverts 7ac1be66b2.
2021-04-14 18:41:29 -07:00
Serg 85ddac9aa8 Addresses code review comments 2021-04-12 16:53:15 -04:00
Serg b6b836d77b Addresses code review comments 2021-04-12 16:31:49 -04:00
Serg e257f918e8 Moves backup results function to service workers 2021-04-09 18:21:05 -04:00
Serg ddf9a2b3b4 Fixes code review suggestions 2021-03-30 22:19:41 -04:00
Serg 9e42e85322 Injects window.chrome.fetchBackupResults 2021-03-30 22:19:41 -04:00
Serg c86eb15346 Fixes code review suggestions 2021-03-25 11:14:32 -04:00
Serg 2ec453742c Fixes code review suggestions 2021-03-24 15:27:42 -04:00
Brian R. Bondy 64a3778dc7 Move wallet browser code to components/brave_wallet/browser 2021-03-24 15:27:42 -04:00
Serg 05587fe9f4 Propogates brave web3 provider pref to renderer 2021-03-24 15:27:42 -04:00
Serg c933857da3 adds custom web3 provider build flag and feature check 2021-03-24 15:27:42 -04:00
Serg 744af6e37a moves Promise from navigator.brave_wallet to window.ethereum directly 2021-03-24 15:27:42 -04:00
Serg 17dbb6c862 adds brave_wallet mojo interface 2021-03-24 15:27:42 -04:00
Serg efc1f2c757 injects window.ethereum object into all frames 2021-03-24 15:27:42 -04:00
bridiver 0106a2588b check for null observer 2021-03-17 13:19:05 -07:00
bridiver fe9f81b773 add parent method call 2021-03-15 18:16:33 -07:00
bridiver a96eb420a7 request cosmetic filter rules when we get the url 2021-03-15 18:16:33 -07:00
Serg e988595fec adds a flag to use native/extension cosmetic filters approach on desktop 2021-03-05 19:01:31 -05:00
Serg 02fb8d0309 fixes ads on yt and gets rid of csp error 2021-02-24 21:38:34 -05:00
bridiver fb3c0f5561 buildtools/checkdeps/checkdeps.py brave --extra-repos=brave runs succesfully 2021-02-06 13:34:00 -07:00
mkarolin cd8030433f Formatting fix. 2021-02-04 23:52:56 -05:00
mkarolin 1736299f10 Disables Serial API in blink.
Per security team request.
2021-02-04 23:52:55 -05:00
mkarolin 6b1b45fd35 Disables WebNFC in blink.
Per security team request.
2021-02-04 23:52:54 -05:00
mkarolin c55c55ce29 Temporarily disabling WebBundles test.
Not sure this can be fixes as is due to the Chromium change below.
Need to come up with a different way of testing that the origin trial
would not work.

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/529f43bc5bed70eda143373a588611acce3bc89e

commit 529f43bc5bed70eda143373a588611acce3bc89e
Author: Hayato Ito <hayato@chromium.org>
Date:   Mon Dec 7 14:25:45 2020 +0000

    Support WebBundle Subresource loading via Network Service

    This is a follow-up to https://crrev.com/c/2560526.

    This CL changes the implementation of WebBundle subresource loading
    from "renderer oriented" to "network service oriented".

    Before this CL, a renderer parses a WebBundle and serves a subresource
    from there directly.

    After this CL, they are done in the Network Service, instead of a renderer.

    The motivation we're changing our design is "we should honor CORB
    [1]". A renderer shouldn't have cross-origin data in their memory.
    See the design doc [2] for details.

    Note this CL removes
    blink/renderer/platform/loader/fetch/url_loader/web_bundle_subresource_loader_test.cc,
    which was already moved to
    services/network/web_bundle_url_loader_factory_unittest.cc in a previous CL.

    - [1]: https://source.chromium.org/chromium/chromium/src/+/master:services/network/cross_origin_read_blocking_explainer md
    - [2]: https://docs.google.com/document/d/1_AqUBS4Gr45MPPtXGTUl7Q0DMIEw2zUeWO0zo6Sj0z4/edit

    Bug: 1082020
2021-02-04 23:52:53 -05:00