-
Notifications
You must be signed in to change notification settings - Fork 892
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
WebTorrent Support #356
WebTorrent Support #356
Conversation
} | ||
#endif // !BUILDFLAG(DISABLE_FTP_SUPPORT) | ||
|
||
+ job_factory->SetProtocolHandler("magnet", std::make_unique<MagnetProtocolHandler>()); |
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.
#353 (review)
This review comment is not yet addressed.
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.
@bridiver Addressed by 3ee9fa7
b486a2f
to
a846eae
Compare
// TODO(devlin): Should we do this for all callbacks? | ||
+ if (!connect_callback_.is_null()) { | ||
+ base::ResetAndReturn(&connect_callback_) | ||
+ .Run(net::ERR_CONNECTION_CLOSED); |
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.
Solve DCHECK erorr at https://cs.chromium.org/chromium/src/extensions/browser/extension_function.cc?sq=package:chromium&g=0&l=504.
Webtorrent hit the DCHECK where SocketsTcpConnectFunction is destructed before any responses are made.
It happens because it is possible for the application to make a request to destroy the socket while previous connect request is still in progress.
This DCHECK is introduced by https://codereview.chromium.org/2017113002, in the same changeset, read_callback is reset and return immediately here.
I'm rebasing on C70, hit a new DCHECK in CreateTCPConnectedSocketCallback, related change: https://chromium.googlesource.com/chromium/src/+/bff8e3ea6d0d7c1f1fe045f595ffaeaf64ff41f9 |
DCHECK for CreateTCPConnectedSocketCallback has been fixed in chromium master, I'll pull it in first. https://chromium.googlesource.com/chromium/src/+/602a66794ef884ce0f961e9c625c649704cfcb83%5E%21/ |
+ if (connect_callback_) { | ||
+ std::move(connect_callback_) | ||
+ .Run(net::ERR_CONNECTION_CLOSED); | ||
+ } |
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.
Solve DCHECK erorr at https://cs.chromium.org/chromium/src/extensions/browser/extension_function.cc?sq=package:chromium&g=0&l=504.
Webtorrent hit the DCHECK where SocketsTcpConnectFunction is destructed before any responses are made.
It happens because it is possible for the application to make a request to destroy the socket while the connect request is still in progress.
This DCHECK is introduced by https://codereview.chromium.org/2017113002, in the same changeset, read_callback is reset and return immediately here.
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.
what is causing SocketsTcpConnectFunction to be destroyed early?
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.
add for accept_callback_
as well as discussed and please submit to upstream
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.
Addressed in 360746b
|
||
-TCPConnectedSocket::~TCPConnectedSocket() {} | ||
+TCPConnectedSocket::~TCPConnectedSocket() { | ||
+ if (connect_callback_) { |
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.
This is pulling from https://chromium.googlesource.com/chromium/src/+/602a66794ef884ce0f961e9c625c649704cfcb83%5E%21/
This patch should be able to be removed in the next chromium upgrade.
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'm fine with the upstream patch, but odd that this doesn't call Disconnect
?
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.
This is for CreateTCPConnectedSocketCallback introduced in C70 but not the extension function itself.
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.
Without this, we'll still hit DCHECK in src/out/Debug/gen/services/network/public/mojom/network_context.mojom.cc,
which checks if CreateTCPConnectedSocketCallback is destructed without respond.
@@ -126,7 +127,8 @@ bool BraveExtensionProvider::UserMayLoad(const Extension* extension, | |||
|
|||
bool BraveExtensionProvider::MustRemainInstalled(const Extension* extension, | |||
base::string16* error) const { | |||
return extension->id() == brave_extension_id; | |||
return extension->id() == brave_extension_id || |
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.
should this be here? Do we want it always loaded by default or on user activation?
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 prefer loaded by default for now if that's OK.
And address it in a follow-up issue to make it able to be turned on and off by user at anytime.
AFAIK, if we want to disable a component extension from UI, it should probably go through chrome://extensions.
First, to see component extensions listed, we'll need to pass --show-component-extension-options when run it.
But it seems I can't toggle the on&off switch even if the component extension is shown for our current version.
I would like to address this in a separate issue.
@bridiver wdyt?
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.
btw, it seems it is still loaded by default even when I remove this line.
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.
this doesn't affect default loading, it only affects the ability to uninstall
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.
c++ stuff looks good
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.
code comments left, mostly nit. No show-stoppers. Unable to test it manually ATM as I'm still compiling
|
||
require('./background/store') | ||
require('./background/events/tabsEvents') | ||
require('./background/events/windowsEvents') |
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: don't import './background/events/windowsEvents'
do the job as well? also init()
could go at the bottom
components/brave_webtorrent/extension/components/torrentViewerHeader.tsx
Outdated
Show resolved
Hide resolved
components/brave_webtorrent/extension/components/torrentViewerHeader.tsx
Outdated
Show resolved
Hide resolved
components/brave_webtorrent/extension/components/torrentViewerHeader.tsx
Outdated
Show resolved
Hide resolved
@cezaraugusto Please review 970343f and a0bb5ec. |
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.
+++++++ for the front-end
@bridiver @cezaraugusto Thanks a lot for the review, I'll squash some commits together and merge this PR after I finish testing it on all platforms. |
…onnected. Solve DCHECK erorr in ~UIThreadExtensionFunction where SocketsTcpConnectFunction is destructed before any responses were made.
…e run. This patch is pulling in the solution from https://chromium.googlesource.com/chromium/src/+/602a66794ef884ce0f961e9c625c649704cfcb83%5E%21/ Should be removed when this changeset is pulled in next chromium upgrade.
Seems fine on Mac and Linux, waiting on windows build. |
Run manual and browser tests on all platforms, seems fine, merging. |
WOOoooo 🎉 and |
Fix brave/brave-browser#289.
What's included in this PR:
What's not included in this PR:
Submitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
Manual Test:
(Note: It might take a while for the media to be ready to play.)
Automation Test:
npm run test -- brave_browser_tests --filter=BraveContentBrowserClientTest.RewriteMagnetURL*
npm run test-unit
Reviewer Checklist: