Merge pull request #4071 from deepak1556/session_flush_data_patch
session: api to flush DOMStorage data
This commit is contained in:
Коммит
489539d62e
|
@ -312,6 +312,12 @@ void Session::ClearStorageData(mate::Arguments* args) {
|
|||
base::Time(), base::Time::Max(), callback);
|
||||
}
|
||||
|
||||
void Session::FlushStorageData() {
|
||||
auto storage_partition =
|
||||
content::BrowserContext::GetStoragePartition(browser_context(), nullptr);
|
||||
storage_partition->Flush();
|
||||
}
|
||||
|
||||
void Session::SetProxy(const net::ProxyConfig& config,
|
||||
const base::Closure& callback) {
|
||||
auto getter = browser_context_->GetRequestContext();
|
||||
|
@ -416,6 +422,7 @@ void Session::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("resolveProxy", &Session::ResolveProxy)
|
||||
.SetMethod("clearCache", &Session::ClearCache)
|
||||
.SetMethod("clearStorageData", &Session::ClearStorageData)
|
||||
.SetMethod("flushStorageData", &Session::FlushStorageData)
|
||||
.SetMethod("setProxy", &Session::SetProxy)
|
||||
.SetMethod("setDownloadPath", &Session::SetDownloadPath)
|
||||
.SetMethod("enableNetworkEmulation", &Session::EnableNetworkEmulation)
|
||||
|
|
|
@ -64,6 +64,7 @@ class Session: public mate::TrackableObject<Session>,
|
|||
void ResolveProxy(const GURL& url, ResolveProxyCallback callback);
|
||||
void ClearCache(const net::CompletionCallback& callback);
|
||||
void ClearStorageData(mate::Arguments* args);
|
||||
void FlushStorageData();
|
||||
void SetProxy(const net::ProxyConfig& config, const base::Closure& callback);
|
||||
void SetDownloadPath(const base::FilePath& path);
|
||||
void EnableNetworkEmulation(const mate::Dictionary& options);
|
||||
|
|
|
@ -179,6 +179,10 @@ Clears the session’s HTTP cache.
|
|||
|
||||
Clears the data of web storages.
|
||||
|
||||
#### `ses.flushStorageData()`
|
||||
|
||||
Writes any unwritten DOMStorage data to disk.
|
||||
|
||||
#### `ses.setProxy(config, callback)`
|
||||
|
||||
* `config` Object
|
||||
|
|
Загрузка…
Ссылка в новой задаче