@@ -225,19 +225,25 @@ impl InnerWebView {
225225 #[ cfg( target_os = "ios" ) ]
226226 let custom_data_store_available = os_major_version >= 17 ;
227227
228- let data_store = match (
229- attributes. incognito ,
230- custom_data_store_available,
231- pl_attrs. data_store_identifier ,
232- ) {
233- ( true , _, _) => WKWebsiteDataStore :: nonPersistentDataStore ( mtm) ,
234- // if data_store_identifier is given and custom data stores are available, use custom store
235- ( false , true , Some ( data_store) ) => {
236- let identifier = NSUUID :: from_bytes ( data_store) ;
237- WKWebsiteDataStore :: dataStoreForIdentifier ( & identifier, mtm)
238- }
239- // default data store
240- _ => WKWebsiteDataStore :: defaultDataStore ( mtm) ,
228+ let data_store = if using_existing_config {
229+ config. websiteDataStore ( )
230+ } else {
231+ let data_store = match (
232+ attributes. incognito ,
233+ custom_data_store_available,
234+ pl_attrs. data_store_identifier ,
235+ ) {
236+ ( true , _, _) => WKWebsiteDataStore :: nonPersistentDataStore ( mtm) ,
237+ // if data_store_identifier is given and custom data stores are available, use custom store
238+ ( false , true , Some ( data_store) ) => {
239+ let identifier = NSUUID :: from_bytes ( data_store) ;
240+ WKWebsiteDataStore :: dataStoreForIdentifier ( & identifier, mtm)
241+ }
242+ // default data store
243+ _ => WKWebsiteDataStore :: defaultDataStore ( mtm) ,
244+ } ;
245+ config. setWebsiteDataStore ( & data_store) ;
246+ data_store
241247 } ;
242248
243249 // Register Custom Protocols
@@ -302,7 +308,6 @@ impl InnerWebView {
302308 custom_protocol_task_ids : Default :: default ( ) ,
303309 } ) ;
304310
305- config. setWebsiteDataStore ( & data_store) ;
306311 let _preference = config. preferences ( ) ;
307312 let _yes = NSNumber :: numberWithBool ( true ) ;
308313
0 commit comments