-
Notifications
You must be signed in to change notification settings - Fork 896
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
Address security concern etld dapps #13385
Address security concern etld dapps #13385
Conversation
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.
I would encourage to start using the domain layer (any possible implementation) with MVVM style to enhance the code quality, classes like Utils is doing too much, yet not efficient. Feel free to use your architectural skills to enhance domain or other areas.
getWalletService().geteTldPlusOneFromOrigin(Utils.getCurrentMojomOrigin(), origin -> { | ||
siteTv.setText(Utils.geteTLDFromGRUL(origin.eTldPlusOne)); | ||
}); | ||
getFavIcon(siteUrl.getOrigin()); |
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.
nit: rename to showFavIcon or something as getFavIcon
returns void
if (activity != null) { | ||
|
||
FaviconImageCallback imageCallback = (bitmap, | ||
iconUrl) -> AddSwitchChainNetworkFragment.this.onFaviconAvailable(url, bitmap); |
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.
nit: is it required AddSwitchChainNetworkFragment.this.
?
} | ||
} | ||
|
||
private void onFaviconAvailable(GURL pageUrl, Bitmap iconBitmap) { |
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.
nit: since it's not a callback method so would be better to rename to showFavIcon
or similar for convention and per title case use Icon
in FavIcon
...oid/java/org/chromium/chrome/browser/crypto_wallet/fragments/dapps/DAppsMessageFragment.java
Show resolved
Hide resolved
</message> | ||
<message name="IDS_BRAVE_WALLET_PROVIDE_ENCRYPTION_KEY_DESCRIPTION" desc="Provide Encryption Key Panel Details">is requesting your wallets public encryption key. If you consent to providing this key, the site will be able to compose encrypted messages to you.</message> |
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.
nit: description doesn't have to be in title case, seems like we have done this before so kindly ignore some existing examples or fix them to avoid the influence.
private BraveWalletService getWalletService() { | ||
assert getActivity() instanceof BraveWalletBaseActivity; | ||
return ((BraveWalletBaseActivity) getActivity()).getBraveWalletService(); | ||
} |
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.
redundant, remove this, BaseDAppsFragment
already has the getBraveWalletService
.
This is one of the side effect of this approach, better start using the domain layer or anything better to improve code quality.
@qamarngr I don't think CI is running btw if you work off your fork. As I see lint format isn't applied as well. Could you please work directly from brave-core repository? |
@@ -112,7 +112,9 @@ public void onClick(View v) { | |||
mRecyclerView = view.findViewById(R.id.accounts_list); | |||
mFavicon = view.findViewById(R.id.favicon); | |||
|
|||
mWebSite.setText(getCurrentHostHttpAddress().getSpec()); | |||
getBraveWalletService().geteTldPlusOneFromOrigin(Utils.getCurrentMojomOrigin(), origin -> { | |||
mWebSite.setText(Utils.geteTLDFromGRUL(origin.eTldPlusOne)); |
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.
GURL?
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.
oh sorry, I refactored it, I was previously passing GURL, later on I removed it.
if (mBraveWalletService != null) { | ||
return; | ||
} | ||
mBraveWalletService = BraveWalletServiceFactory.getInstance().getBraveWalletService(this); |
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 need to close the service in DisconnectMojoServices
Duplicate of #13398 |
Resolves brave/brave-browser#21798
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Same as
#12701