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

Auto-load via IPFS notification isn't sticky when loading an IPFS/IPNS page #22329

Conversation

vadimstruts
Copy link
Collaborator

@vadimstruts vadimstruts commented Feb 26, 2024

Resolves brave/brave-browser#36347

The problem is related to hiding the auto-load via IPFS infobar because of some redirect.

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@@ -523,6 +532,9 @@ void IPFSTabHelper::DidFinishNavigation(content::NavigationHandle* handle) {
block_redirect_nav_data && block_redirect_nav_data->enable_redirect_block;

MaybeCheckDNSLinkRecord(handle->GetResponseHeaders(), auto_redirect_blocked);
if(IsRedirectToSubLevelUrl(handle, GetCurrentPageURL())) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why it doesn't work as is?
UpdateLocationBar is also called to update IPFS button state in the omnibar and i see that in the video there is an IPFS button after redirect to /wiki/. Was UpdateLocationBar called?

Copy link
Collaborator Author

@vadimstruts vadimstruts Feb 27, 2024

Choose a reason for hiding this comment

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

Was UpdateLocationBar called?

No, It wasn't called because after redirect to /wiki/ the host is the same, and only path changed.
For now we have only this condition: resolver_->host() != current.host() , which prevents us from UpdateLocationBar() calling.
I propose add the additional one: (resolver_->host() == current.host() && ipfs_resolved_url_.path() != current.path()) to cover the situation when we have only URL's path changed after redirect

@vadimstruts vadimstruts force-pushed the 36347-auto-load-via-ipfs-notification-isnt-sticky-when-loading-an-ipfsipns-page branch from 71b4868 to 6391368 Compare February 27, 2024 10:04
Signed-off-by: Vadym Struts <vstruts@brave.com>
@vadimstruts vadimstruts force-pushed the 36347-auto-load-via-ipfs-notification-isnt-sticky-when-loading-an-ipfsipns-page branch from 6391368 to 46f38f4 Compare February 27, 2024 12:06
@vadimstruts vadimstruts marked this pull request as ready for review February 27, 2024 14:53
@@ -458,6 +458,7 @@ void IPFSTabHelper::MaybeCheckDNSLinkRecord(

if (!IsDNSLinkCheckEnabled() || !headers || ipfs_resolved_url_.is_valid() ||
!CanResolveURL(dnslink_target)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a test for this case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

…side redirect

Signed-off-by: Vadym Struts <vstruts@brave.com>
Copy link
Collaborator

@cypt4 cypt4 left a comment

Choose a reason for hiding this comment

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

++

@vadimstruts vadimstruts merged commit 5fb9a21 into master Feb 28, 2024
19 checks passed
@vadimstruts vadimstruts deleted the 36347-auto-load-via-ipfs-notification-isnt-sticky-when-loading-an-ipfsipns-page branch February 28, 2024 11:36
@github-actions github-actions bot added this to the 1.65.x - Nightly milestone Feb 28, 2024
brave-builds added a commit that referenced this pull request Feb 28, 2024
@kjozwiak
Copy link
Member

kjozwiak commented Mar 2, 2024

Verification PASSED on Win 11 x64 using the following build(s):

Brave | 1.65.49 Chromium: 122.0.6261.94 (Official Build) nightly (64-bit)
-- | --
Revision | da6ba557e9bdb49517ffee192ba7d48ebe105ea8
OS | Windows 11 Version 23H2 (Build 22631.3235)

Using the STR/Cases outlined via brave/brave-browser#36347 (comment), ensured that loading ipns://en.wikipedia-on-ipfs.org while IPFS is disabled and set to Ask via brave://settings/web3 loads the Set your IPFS preference onboarding page without any issues as per the following:

image

kjozwiak pushed a commit that referenced this pull request Mar 2, 2024
…S page (uplift to 1.64.x) (#22370)

Uplift of #22329 (squashed) to beta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants