Skip to content

Commit

Permalink
Disable Chromium Session-Restore for WebState and WebViews
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T committed Sep 7, 2023
1 parent e2ec3eb commit 3692389
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions ios/browser/api/web/web_state/web_state_native.mm
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@
session_id_ =
SyncedWindowDelegateBrowserAgent::FromBrowser(browser_)->GetSessionId();

// Create session storage with an empty item storage
NSMutableArray<CRWNavigationItemStorage*>* item_storages =
[[NSMutableArray alloc] init];
CRWNavigationItemStorage* item = [[CRWNavigationItemStorage alloc] init];
[item_storages addObject:item];

CRWSessionStorage* session_storage = [[CRWSessionStorage alloc] init];
session_storage.stableIdentifier = [[NSUUID UUID] UUIDString];
session_storage.uniqueIdentifier = SessionID::NewUnique();
session_storage.itemStorages = [item_storages copy];
session_storage.userAgentType = web::UserAgentType::MOBILE;

// Create BrowserState
ChromeBrowserState* browser_state = browser->GetBrowserState();
if (off_the_record) {
Expand All @@ -60,8 +48,7 @@
// Create WebState with parameters
web::WebState::CreateParams create_params(browser_state);
create_params.last_active_time = base::Time::Now();
auto web_state =
web::WebState::CreateWithStorageSession(create_params, session_storage);
auto web_state = web::WebState::Create(create_params);
web_state->ForceRealized();

// Setup Observers of the WebState
Expand Down

0 comments on commit 3692389

Please sign in to comment.