-
Notifications
You must be signed in to change notification settings - Fork 877
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
Only load IPFS subresources within IPFS/IPNS schemes #7194
Conversation
d706b02
to
afe446d
Compare
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.
chromium_src
override LGTM
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.
LGTM!
afe446d
to
d923edf
Compare
namespace network_utils { | ||
|
||
bool IsURLHandledByNetworkService(const GURL& url) { | ||
if (url.SchemeIs("ipns") || url.SchemeIs("ipfs")) { |
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.
minor, but I'd try to transform all of "ipfs"/"ipns" to some constant defined somewhere at ipfs_constants.h
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 think I'd have to patch in a dependency in that case no?
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.
right, np then
ASSERT_TRUE(ExecuteScriptAndExtractBool( | ||
|
||
std::string location; | ||
ASSERT_TRUE(ExecuteScriptAndExtractString( |
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.
ExecuteScriptAndExtractString
is deprecated in favor of EvalJs
(see browser_test_utils.h
). Also it should be possible to set an onload handler (i.e. avoid using the timer)
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.
ok thanks
"}, 100);", | ||
&location)); | ||
|
||
ASSERT_EQ(location, "chrome-error://chromewebdata/"); |
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 think EXPECT_EQ
is more widespreaded across the codebase
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 think they are different, expect eq keeps running the test but assert eq fails the test instantly
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.
They are indeed different, and the default choice is typically EXPECT_EQ
. Not something important, especially for the last assertion in a test, just style
13a83ad
to
8d5e0ae
Compare
For some reason they are blocked when not done from the network service. I checked with Ivan and BrianJ and they are OK with marking ipns and ipfs as handled by the network service
9717ee5
to
762bd0a
Compare
When a local node is installed, by visiting a page that allows you to load IPFS resources, it will then make you a host of any resources that the page loads. To avoid this, this PR makes ipfs:// and ipns subresources only load when the top level main frame is also ipfs:// or ipns://.
This PR also fixes a problem where iframes would not load at all that were ipfs scheme.
It also removes the external protocol handler that existed.
Resolves brave/brave-browser#12546
Resolves brave/brave-browser#12931
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: