Parse partition in webContents.create
This commit is contained in:
parent
2454dccde0
commit
5eb0bedbbc
2 changed files with 6 additions and 12 deletions
|
@ -165,9 +165,12 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
std::string partition;
|
||||
mate::Handle<api::Session> session;
|
||||
if (options.Get("session", &session)) {
|
||||
} else if (options.Get("partition", &partition)) {
|
||||
} else if (options.Get("partition", &partition) && !partition.empty()) {
|
||||
bool in_memory = true;
|
||||
options.Get("inMemory", &in_memory);
|
||||
if (base::StartsWith(partition, "persist:", base::CompareCase::SENSITIVE)) {
|
||||
in_memory = false;
|
||||
partition = partition.substr(8);
|
||||
}
|
||||
session = Session::FromPartition(isolate, partition, in_memory);
|
||||
} else {
|
||||
// Use the default session if not specified.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue