Commit d07a4a17 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Add NavigationContextImpl::IsLoadingHtml.

This boolean will be true for loadHTMLString: navigations.

-[CRWWebController setDocumentURL:] will have a DCHECK when new document
URL does not match last committed URL in WKBasedNavigationManager. This
DCHECK will help to diagnose possible URL spoofing bugs in Slim
Navigation feature.

For loadHTMLString: the URLs will not match, which is not a problem
because loadHTMLString: are only used in tests and error pages.

Bug: 876077
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Iae163faf7f5cf90d5bb0e48a191786be2e1d8ee6
Reviewed-on: https://chromium-review.googlesource.com/1182313Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584740}
parent e6c8f25f
......@@ -68,11 +68,18 @@ class NavigationContextImpl : public NavigationContext {
void SetWKNavigationType(WKNavigationType wk_navigation_type);
WKNavigationType GetWKNavigationType() const;
// true if this navigation context is a loadHTMLString: navigation used to
// load Error page into web view.
// true if this navigation context is a -[WKWebView loadHTMLString:baseURL:]
// navigation used to load Error page into web view. IsLoadingErrorPage() and
// IsLoadingHtmlString() are mutually exclusive.
bool IsLoadingErrorPage() const;
void SetLoadingErrorPage(bool is_loading_error_page);
// true if this navigation context is a -[WKWebView loadHTMLString:baseURL:]
// navigation. IsLoadingErrorPage() and IsLoadingHtmlString() are mutually
// exclusive.
bool IsLoadingHtmlString() const;
void SetLoadingHtmlString(bool is_loading_html);
// true if this navigation context is a placeholder navigation associated with
// a native view URL and the native content is already presented.
bool IsNativeContentPresented() const;
......@@ -100,6 +107,7 @@ class NavigationContextImpl : public NavigationContext {
int navigation_item_unique_id_ = -1;
WKNavigationType wk_navigation_type_ = WKNavigationTypeOther;
bool is_loading_error_page_ = false;
bool is_loading_html_string_ = false;
bool is_native_content_presented_ = false;
DISALLOW_COPY_AND_ASSIGN(NavigationContextImpl);
......
......@@ -158,6 +158,14 @@ void NavigationContextImpl::SetLoadingErrorPage(bool is_loading_error_page) {
is_loading_error_page_ = is_loading_error_page;
}
bool NavigationContextImpl::IsLoadingHtmlString() const {
return is_loading_html_string_;
}
void NavigationContextImpl::SetLoadingHtmlString(bool is_loading_html_string) {
is_loading_html_string_ = is_loading_html_string;
}
bool NavigationContextImpl::IsNativeContentPresented() const {
return is_native_content_presented_;
}
......
......@@ -4020,6 +4020,7 @@ registerLoadRequestForURL:(const GURL&)requestURL
sameDocumentNavigation:NO
hasUserGesture:true];
}
context->SetLoadingHtmlString(true);
[_navigationStates setContext:std::move(context) forNavigation:navigation];
}
......
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