feat: add session.storagePath to get path on disk for session data (#28665)

This commit is contained in:
Samuel Attard 2021-04-27 09:54:28 -07:00 committed by GitHub
parent b97b973306
commit fa61e3b119
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 1 deletions

View file

@ -964,6 +964,13 @@ v8::Local<v8::Promise> Session::CloseAllConnections() {
return handle;
}
v8::Local<v8::Value> Session::GetPath(v8::Isolate* isolate) {
if (browser_context_->IsOffTheRecord()) {
return v8::Null(isolate);
}
return gin::ConvertToV8(isolate, browser_context_->GetPath());
}
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
base::Value Session::GetSpellCheckerLanguages() {
return browser_context_->prefs()
@ -1188,11 +1195,13 @@ gin::ObjectTemplateBuilder Session::GetObjectTemplateBuilder(
#endif
.SetMethod("preconnect", &Session::Preconnect)
.SetMethod("closeAllConnections", &Session::CloseAllConnections)
.SetMethod("getStoragePath", &Session::GetPath)
.SetProperty("cookies", &Session::Cookies)
.SetProperty("netLog", &Session::NetLog)
.SetProperty("protocol", &Session::Protocol)
.SetProperty("serviceWorkers", &Session::ServiceWorkerContext)
.SetProperty("webRequest", &Session::WebRequest);
.SetProperty("webRequest", &Session::WebRequest)
.SetProperty("storagePath", &Session::GetPath);
}
const char* Session::GetTypeName() {