Skip to content
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

Backend Work for Crypto Wallets reset feature #4364

Merged
merged 2 commits into from
Jan 21, 2020
Merged

Conversation

ryanml
Copy link
Contributor

@ryanml ryanml commented Jan 13, 2020

Partially fixes: brave/brave-browser#5741
Fixes: brave/brave-browser#7716

After the deletion of the DB entry, two things have to happen:

  1. All tabs containing brave://wallet need to close
  2. Brave must restart

Submitter Checklist:

Test Plan:

Note: The Extension at this time lacks the "management" permissions allowing programmatic reload, so the above snippet will not work. However, these steps can be used to verify functionality:

  1. Clean profile, navigate to brave://wallet
  2. Import/create a new wallet
  3. Confirm wallet has been created.
  4. In that page, open up the console.
  5. Run:
chrome.braveWallet.resetWallet()
  1. Crypto wallets tabs will close and Brave will restart
  2. Navigate to brave://wallet, confirm state is fresh
  3. Do the above steps then both create a new wallet and import an account and confirm this works as expected.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@ryanml ryanml added this to the 1.5.x - Nightly milestone Jan 13, 2020
@ryanml ryanml self-assigned this Jan 13, 2020
@ryanml ryanml force-pushed the reset-crypto-wallets branch 2 times, most recently from 0a75e5c to 53c6327 Compare January 13, 2020 21:19
@ryanml ryanml requested a review from bbondy January 13, 2020 21:20
@ryanml ryanml force-pushed the reset-crypto-wallets branch 3 times, most recently from 781c5fc to 6f397b0 Compare January 15, 2020 21:37
Copy link
Member

@bbondy bbondy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 minor nit, and 1 question to make sure it's right behavior. Nice work.

browser/extensions/api/brave_wallet_api.cc Outdated Show resolved Hide resolved
GURL url = web_contents->GetURL();
if (url.SchemeIs(content::kChromeUIScheme) &&
url.host() == ethereum_remote_client_host) {
web_contents->Close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this actually get rid of the tab_strip's webcontents too? if so this might cause some wonkiness with the iterator on the count.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do some tests and double check, I'll report back 👍

@ryanml ryanml merged commit 20b6790 into master Jan 21, 2020
@ryanml ryanml deleted the reset-crypto-wallets branch January 21, 2020 18:48
#include "components/keyed_service/core/keyed_service.h"

namespace base {
class SequencedTaskRunner;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this here? It isn't referenced anywhere in the header

BraveWalletService::BraveWalletService(content::BrowserContext* context)
: context_(context),
controller_(new BraveWalletController(context)),
weak_factory_(this) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this have a weak ptr? It is never used for anything

}

// static
BraveWalletService* BraveWalletServiceFactory::GetForProfile(Profile* profile) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this factory needs to go in brave/browser/brave_wallet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved that already in a diff PR a few weeks ago

@urbenlegend
Copy link

Has the fix been released into Brave stable yet? Currently chrome.braveWallet.resetWallet() does nothing when run in the console on the Wallets page.

@paulvi
Copy link

paulvi commented Apr 27, 2021

This PR closes brave/brave-browser#5741 however there is no hint how to actually remove/initialize Brave Wallet

@urbenlegend

chrome.braveWallet.resetWallet() run in the console on the Wallets page.
Where did you find this action suggestion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Service/Controller for BraveWallet Add reset data / delete account option to Crypto Wallets
5 participants