-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9858 from brave/maxk-cr93fu-fix-webtorrent-crash
[cr93 followup] Fix for webtorrent crash.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
patches/extensions-browser-api-sockets_tcp_server-sockets_tcp_server_api.cc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
diff --git a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc | ||
index fcba8ac797b18084efd5a79ae7cdf25487a61407..abf5c544601b32ca6898f64b9bd3927dceff4a41 100644 | ||
--- a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc | ||
+++ b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc | ||
@@ -256,15 +256,15 @@ SocketsTcpServerGetInfoFunction::~SocketsTcpServerGetInfoFunction() = default; | ||
ExtensionFunction::ResponseAction SocketsTcpServerGetInfoFunction::Work() { | ||
std::unique_ptr<sockets_tcp_server::GetInfo::Params> params = | ||
sockets_tcp_server::GetInfo::Params::Create(*args_); | ||
- EXTENSION_FUNCTION_VALIDATE(params_.get()); | ||
+ EXTENSION_FUNCTION_VALIDATE(params.get()); | ||
|
||
- ResumableTCPServerSocket* socket = GetTcpSocket(params_->socket_id); | ||
+ ResumableTCPServerSocket* socket = GetTcpSocket(params->socket_id); | ||
if (!socket) { | ||
return RespondNow(Error(kSocketNotFoundError)); | ||
} | ||
|
||
sockets_tcp_server::SocketInfo socket_info = | ||
- CreateSocketInfo(params_->socket_id, socket); | ||
+ CreateSocketInfo(params->socket_id, socket); | ||
return RespondNow( | ||
ArgumentList(sockets_tcp_server::GetInfo::Results::Create(socket_info))); | ||
} |
14 changes: 14 additions & 0 deletions
14
patches/extensions-browser-api-sockets_tcp_server-sockets_tcp_server_api.h.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h | ||
index 39d68080d449de6a3de282afe4d6335652402e06..d60fa8bbe677c83037f26c5b3cfd286d6a79bd8a 100644 | ||
--- a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h | ||
+++ b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h | ||
@@ -134,9 +134,6 @@ class SocketsTcpServerGetInfoFunction : public TCPServerSocketApiFunction { | ||
|
||
// SocketApiFunction: | ||
ResponseAction Work() override; | ||
- | ||
- private: | ||
- std::unique_ptr<sockets_tcp_server::GetInfo::Params> params_; | ||
}; | ||
|
||
class SocketsTcpServerGetSocketsFunction : public TCPServerSocketApiFunction { |
16 changes: 16 additions & 0 deletions
16
patches/extensions-test-data-sockets_tcp_server-api-background.js.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/extensions/test/data/sockets_tcp_server/api/background.js b/extensions/test/data/sockets_tcp_server/api/background.js | ||
index 8a2ff5ee95c74b1cc4e9a9e6bf62db889fe83309..f25b1e7dead44c84bc3019103a95a3c9101f9a91 100644 | ||
--- a/extensions/test/data/sockets_tcp_server/api/background.js | ||
+++ b/extensions/test/data/sockets_tcp_server/api/background.js | ||
@@ -43,6 +43,11 @@ var testSocketListening = function() { | ||
function onServerSocketCreate(socketInfo) { | ||
console.log("Server socket created: sd=" + socketInfo.socketId); | ||
socketId = socketInfo.socketId; | ||
+ chrome.sockets.tcpServer.getInfo(socketId, onGetInfo); | ||
+ } | ||
+ | ||
+ function onGetInfo(socketInfo) { | ||
+ chrome.test.assertEq(socketInfo.socketId, socketId); | ||
chrome.sockets.tcpServer.listen(socketId, address, port, onListen); | ||
} | ||
|