diff --git a/patches/extensions-browser-api-socket-tcp_socket.cc.patch b/patches/extensions-browser-api-socket-tcp_socket.cc.patch new file mode 100644 index 000000000000..af04e3f8468a --- /dev/null +++ b/patches/extensions-browser-api-socket-tcp_socket.cc.patch @@ -0,0 +1,23 @@ +diff --git a/extensions/browser/api/socket/tcp_socket.cc b/extensions/browser/api/socket/tcp_socket.cc +index e80bd7718bee608d4805d8d5ff63642296f20335..d0661a666757d0440b636e0177454e41675abbf6 100644 +--- a/extensions/browser/api/socket/tcp_socket.cc ++++ b/extensions/browser/api/socket/tcp_socket.cc +@@ -149,8 +149,16 @@ void TCPSocket::Disconnect(bool socket_destroying) { + client_socket_.reset(); + server_socket_.reset(); + listen_callback_.Reset(); +- connect_callback_.Reset(); +- accept_callback_.Reset(); ++ if (connect_callback_) { ++ std::move(connect_callback_) ++ .Run(net::ERR_CONNECTION_CLOSED); ++ } ++ if (accept_callback_) { ++ std::move(accept_callback_) ++ .Run(net::ERR_CONNECTION_CLOSED, nullptr, base::nullopt, ++ mojo::ScopedDataPipeConsumerHandle(), ++ mojo::ScopedDataPipeProducerHandle()); ++ } + // TODO(devlin): Should we do this for all callbacks? + if (read_callback_) { + std::move(read_callback_)