|
@@ -318,6 +318,14 @@ ElectronBrowserContext::browser_context_map() {
|
|
|
return *browser_context_map;
|
|
|
}
|
|
|
|
|
|
+// static
|
|
|
+void ElectronBrowserContext::DestroyAllContexts() {
|
|
|
+ auto& map = browser_context_map();
|
|
|
+ // Avoid UAF by destroying the default context last. See ba629e3 for info.
|
|
|
+ const auto extracted = map.extract(PartitionKey{"", false});
|
|
|
+ map.clear();
|
|
|
+}
|
|
|
+
|
|
|
ElectronBrowserContext::ElectronBrowserContext(
|
|
|
const PartitionOrPath partition_location,
|
|
|
bool in_memory,
|
|
@@ -837,6 +845,12 @@ ElectronBrowserContext* ElectronBrowserContext::From(
|
|
|
return context.get();
|
|
|
}
|
|
|
|
|
|
+// static
|
|
|
+ElectronBrowserContext* ElectronBrowserContext::GetDefaultBrowserContext(
|
|
|
+ base::Value::Dict options) {
|
|
|
+ return ElectronBrowserContext::From("", false, std::move(options));
|
|
|
+}
|
|
|
+
|
|
|
ElectronBrowserContext* ElectronBrowserContext::FromPath(
|
|
|
const base::FilePath& path,
|
|
|
base::Value::Dict options) {
|