| Index: ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| index 577229e81c646a2a9b0a78f93dfbfd6abd85e2eb..6e33dddb3ff1f1157c61c0c052b9403c122217d6 100644
|
| --- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| +++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| @@ -192,12 +192,6 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
|
| // Object for loading POST requests with body.
|
| base::scoped_nsobject<CRWJSPOSTRequestLoader> _POSTRequestLoader;
|
|
|
| - // Whether the web page is currently performing window.history.pushState or
|
| - // window.history.replaceState
|
| - // Set to YES on window.history.willChangeState message. To NO on
|
| - // window.history.didPushState or window.history.didReplaceState.
|
| - BOOL _changingHistoryState;
|
| -
|
| // CRWWebUIManager object for loading WebUI pages.
|
| base::scoped_nsobject<CRWWebUIManager> _webUIManager;
|
|
|
| @@ -1301,7 +1295,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
|
| // registering a load request logically comes before updating the document
|
| // URL, but also must come first since it uses state that is reset on URL
|
| // changes.
|
| - if (!_changingHistoryState) {
|
| + if (!self.changingHistoryState) {
|
| // If this wasn't a previously-expected load (e.g., certain back/forward
|
| // navigations), register the load request.
|
| if (![self isLoadRequestPendingForURL:newURL])
|
| @@ -1310,7 +1304,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
|
|
|
| [self setDocumentURL:newURL];
|
|
|
| - if (!_changingHistoryState) {
|
| + if (!self.changingHistoryState) {
|
| [self didStartLoadingURL:_documentURL updateHistory:YES];
|
| [self updateSSLStatusForCurrentNavigationItem];
|
| [self didFinishNavigation];
|
| @@ -1375,25 +1369,6 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
|
| return NO;
|
| }
|
|
|
| -- (SEL)selectorToHandleJavaScriptCommand:(const std::string&)command {
|
| - static std::map<std::string, SEL>* handlers = nullptr;
|
| - static dispatch_once_t onceToken;
|
| - dispatch_once(&onceToken, ^{
|
| - handlers = new std::map<std::string, SEL>();
|
| - (*handlers)["window.history.didPushState"] =
|
| - @selector(handleWindowHistoryDidPushStateMessage:context:);
|
| - (*handlers)["window.history.didReplaceState"] =
|
| - @selector(handleWindowHistoryDidReplaceStateMessage:context:);
|
| - (*handlers)["window.history.willChangeState"] =
|
| - @selector(handleWindowHistoryWillChangeStateMessage:context:);
|
| - });
|
| - DCHECK(handlers);
|
| - auto iter = handlers->find(command);
|
| - return iter != handlers->end()
|
| - ? iter->second
|
| - : [super selectorToHandleJavaScriptCommand:command];
|
| -}
|
| -
|
| - (BOOL)shouldAbortLoadForCancelledError:(NSError*)error {
|
| DCHECK_EQ(error.code, NSURLErrorCancelled);
|
| // Do not abort the load if it is for an app specific URL, as such errors
|
| @@ -1458,33 +1433,6 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
|
| }
|
|
|
| #pragma mark -
|
| -#pragma mark JavaScript message handlers
|
| -
|
| -- (BOOL)handleWindowHistoryWillChangeStateMessage:
|
| - (base::DictionaryValue*)message
|
| - context:(NSDictionary*)context {
|
| - _changingHistoryState = YES;
|
| - return
|
| - [super handleWindowHistoryWillChangeStateMessage:message context:context];
|
| -}
|
| -
|
| -- (BOOL)handleWindowHistoryDidPushStateMessage:(base::DictionaryValue*)message
|
| - context:(NSDictionary*)context {
|
| - DCHECK(_changingHistoryState);
|
| - _changingHistoryState = NO;
|
| - return [super handleWindowHistoryDidPushStateMessage:message context:context];
|
| -}
|
| -
|
| -- (BOOL)handleWindowHistoryDidReplaceStateMessage:
|
| - (base::DictionaryValue*)message
|
| - context:(NSDictionary*)context {
|
| - DCHECK(_changingHistoryState);
|
| - _changingHistoryState = NO;
|
| - return [super handleWindowHistoryDidReplaceStateMessage:message
|
| - context:context];
|
| -}
|
| -
|
| -#pragma mark -
|
| #pragma mark WebUI
|
|
|
| - (void)createWebUIForURL:(const GURL&)URL {
|
|
|