|
@@ -903,6 +903,19 @@ void Session::Preconnect(const gin_helper::Dictionary& options,
|
|
|
url, num_sockets_to_preconnect));
|
|
|
}
|
|
|
|
|
|
+v8::Local<v8::Promise> Session::CloseAllConnections() {
|
|
|
+ v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
|
|
+ gin_helper::Promise<void> promise(isolate);
|
|
|
+ auto handle = promise.GetHandle();
|
|
|
+
|
|
|
+ content::BrowserContext::GetDefaultStoragePartition(browser_context_)
|
|
|
+ ->GetNetworkContext()
|
|
|
+ ->CloseAllConnections(base::BindOnce(
|
|
|
+ gin_helper::Promise<void>::ResolvePromise, std::move(promise)));
|
|
|
+
|
|
|
+ return handle;
|
|
|
+}
|
|
|
+
|
|
|
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
|
|
base::Value Session::GetSpellCheckerLanguages() {
|
|
|
return browser_context_->prefs()
|
|
@@ -1106,6 +1119,7 @@ gin::ObjectTemplateBuilder Session::GetObjectTemplateBuilder(
|
|
|
&Session::RemoveWordFromSpellCheckerDictionary)
|
|
|
#endif
|
|
|
.SetMethod("preconnect", &Session::Preconnect)
|
|
|
+ .SetMethod("closeAllConnections", &Session::CloseAllConnections)
|
|
|
.SetProperty("cookies", &Session::Cookies)
|
|
|
.SetProperty("netLog", &Session::NetLog)
|
|
|
.SetProperty("protocol", &Session::Protocol)
|