Commit 52f7e12e authored by Yi Su's avatar Yi Su Committed by Commit Bot

Move CRWWebController.removeAllWebFrames into CRWWKNavigationHandler.

This CL moves CRWWebController.removeAllWebFrames into
CRWWKNavigationHandler.

Bug: 956511
Change-Id: I645d20a59c237f99edb474720dc96f8e8d15d392
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1645352Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Yi Su <mrsuyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666433}
parent d1e8057e
......@@ -93,10 +93,6 @@ class WKBackForwardListItemHolder;
rendererInitiated:(BOOL)renderedInitiated
placeholderNavigation:(BOOL)placeholderNavigation;
// Instructs the delegate to clear the web frames list.
- (void)navigationHandlerRemoveAllWebFrames:
(CRWWKNavigationHandler*)navigationHandler;
// Instructs the delegate to display the webView.
- (void)navigationHandlerDisplayWebView:
(CRWWKNavigationHandler*)navigationHandler;
......
......@@ -698,7 +698,7 @@ const web::CertVerificationErrorsCacheType::size_type kMaxCertErrorsCount = 100;
}
}
[self.delegate navigationHandlerRemoveAllWebFrames:self];
[self removeAllWebFrames];
// This must be reset at the end, since code above may need information about
// the pending load.
self.pendingNavigationInfo = nil;
......@@ -831,7 +831,7 @@ const web::CertVerificationErrorsCacheType::size_type kMaxCertErrorsCount = 100;
[self commitPendingNavigationInfoInWebView:webView];
[self.delegate navigationHandlerRemoveAllWebFrames:self];
[self removeAllWebFrames];
// This point should closely approximate the document object change, so reset
// the list of injected scripts to those that are automatically injected.
......@@ -1091,7 +1091,7 @@ const web::CertVerificationErrorsCacheType::size_type kMaxCertErrorsCount = 100;
forNavigation:navigation
webView:webView
provisionalLoad:NO];
[self.delegate navigationHandlerRemoveAllWebFrames:self];
[self removeAllWebFrames];
_certVerificationErrors->Clear();
[self forgetNullWKNavigation:navigation];
}
......@@ -1144,6 +1144,7 @@ const web::CertVerificationErrorsCacheType::size_type kMaxCertErrorsCount = 100;
_certVerificationErrors->Clear();
self.webProcessCrashed = YES;
[self removeAllWebFrames];
[self.delegate navigationHandlerWebProcessDidCrash:self];
}
......@@ -1968,6 +1969,16 @@ const web::CertVerificationErrorsCacheType::size_type kMaxCertErrorsCount = 100;
self.webStateImpl->OnPageLoaded(failingURL, NO);
}
// Clears the frames list.
- (void)removeAllWebFrames {
web::WebFramesManagerImpl* framesManager =
web::WebFramesManagerImpl::FromWebState(self.webStateImpl);
for (auto* frame : framesManager->GetAllWebFrames()) {
self.webStateImpl->OnWebFrameUnavailable(frame);
}
framesManager->RemoveAllWebFrames();
}
#pragma mark - Public methods
- (void)stopLoading {
......
......@@ -354,8 +354,6 @@ GURL URLEscapedForHistory(const GURL& url) {
- (void)frameBecameAvailableWithMessage:(WKScriptMessage*)message;
// Handles frame became unavailable message.
- (void)frameBecameUnavailableWithMessage:(WKScriptMessage*)message;
// Clears the frames list.
- (void)removeAllWebFrames;
// Restores the state for this page from session history.
- (void)restoreStateFromHistory;
......@@ -2243,15 +2241,6 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
}
}
- (void)removeAllWebFrames {
web::WebFramesManagerImpl* framesManager =
web::WebFramesManagerImpl::FromWebState([self webState]);
for (auto* frame : framesManager->GetAllWebFrames()) {
self.webStateImpl->OnWebFrameUnavailable(frame);
}
framesManager->RemoveAllWebFrames();
}
#pragma mark - JavaScript message handlers
// Handlers for JavaScript messages. |message| contains a JavaScript command and
// data relevant to the message, and |context| contains contextual information
......@@ -3695,11 +3684,6 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
placeholderNavigation:placeholderNavigation];
}
- (void)navigationHandlerRemoveAllWebFrames:
(CRWWKNavigationHandler*)navigationHandler {
[self removeAllWebFrames];
}
- (void)navigationHandlerDisplayWebView:
(CRWWKNavigationHandler*)navigationHandler {
[self displayWebView];
......@@ -3737,7 +3721,6 @@ typedef void (^ViewportStateCompletion)(const web::PageViewportState*);
- (void)navigationHandlerWebProcessDidCrash:
(CRWWKNavigationHandler*)navigationHandler {
[self removeAllWebFrames];
// On iOS 11 WKWebView does not repaint after crash and reload. Recreating
// web view fixes the issue. TODO(crbug.com/770914): Remove this workaround
// once rdar://35063950 is fixed.
......
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