Commit bd22b04d authored by Hiroshi Ichikawa's avatar Hiroshi Ichikawa Committed by Commit Bot

Correct clean up condition in -resetWebStateWithSessionStorage:.

Originally all clean up was conditioned on
_webState->GetView().superview == self, which looks wrong. So I removed
the condition except for [_webState->GetView() removeFromSuperview].

It may not cause any issues in practice, though.

Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I2ce98cc4b568c6b450d20c5193f5eaebad7cde96
Reviewed-on: https://chromium-review.googlesource.com/c/1280088Reviewed-by: default avatarJohn Wu <jzw@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599650}
parent 2d2a1b83
...@@ -550,18 +550,19 @@ static NSString* gUserAgentProduct = nil; ...@@ -550,18 +550,19 @@ static NSString* gUserAgentProduct = nil;
// The WebState is restored from |sessionStorage| if provided. // The WebState is restored from |sessionStorage| if provided.
- (void)resetWebStateWithSessionStorage: - (void)resetWebStateWithSessionStorage:
(nullable CRWSessionStorage*)sessionStorage { (nullable CRWSessionStorage*)sessionStorage {
if (_webState && _webState->GetView().superview == self) { if (_webState) {
if (_webStateObserver) { if (_webStateObserver) {
_webState->RemoveObserver(_webStateObserver.get()); _webState->RemoveObserver(_webStateObserver.get());
} }
for (const auto& pair : _scriptCommandCallbacks) { for (const auto& pair : _scriptCommandCallbacks) {
_webState->RemoveScriptCommandCallback(pair.first); _webState->RemoveScriptCommandCallback(pair.first);
} }
if (_webState->GetView().superview == self) {
// The web view provided by the old |_webState| has been added as a subview. // The web view provided by the old |_webState| has been added as a
// It must be removed and replaced with a new |_webState|'s web view, which // subview. It must be removed and replaced with a new |_webState|'s web
// is added later. // view, which is added later.
[_webState->GetView() removeFromSuperview]; [_webState->GetView() removeFromSuperview];
}
} }
BOOL allowsBackForwardNavigationGestures = BOOL allowsBackForwardNavigationGestures =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment