OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1846 DCHECK(holder); | 1846 DCHECK(holder); |
1847 return holder; | 1847 return holder; |
1848 } | 1848 } |
1849 | 1849 |
1850 - (void)updateCurrentBackForwardListItemHolder { | 1850 - (void)updateCurrentBackForwardListItemHolder { |
1851 // WebUI pages (which are loaded via loadHTMLString:baseURL:) have no entry | 1851 // WebUI pages (which are loaded via loadHTMLString:baseURL:) have no entry |
1852 // in the back/forward list, so the current item will still be the previous | 1852 // in the back/forward list, so the current item will still be the previous |
1853 // page, and should not be associated. | 1853 // page, and should not be associated. |
1854 if (_webUIManager) | 1854 if (_webUIManager) |
1855 return; | 1855 return; |
1856 // When navigating to a page created with window.history.pushState using a | |
1857 // WKBackForwardListItem, the WKWebViewConfiguration's user scripts are not | |
1858 // injected. As a result, the WKBackForwardList will become out of sync with | |
Eugene But (OOO till 7-30)
2016/08/30 00:48:57
Sounds like if scripts are not injected than spoof
kkhorimoto
2016/08/30 00:54:41
Sorry, the URL spoofing issue was the result of on
| |
1859 // the NavigationManager, allowing for URL spoofing attacks. | |
1860 web::NavigationItemImpl* currentItem = | |
1861 [self currentSessionEntry].navigationItemImpl; | |
1862 if (currentItem->IsCreatedFromPushState()) | |
1863 return; | |
1856 | 1864 |
1857 web::WKBackForwardListItemHolder* holder = | 1865 web::WKBackForwardListItemHolder* holder = |
1858 [self currentBackForwardListItemHolder]; | 1866 [self currentBackForwardListItemHolder]; |
1859 | 1867 |
1860 WKNavigationType navigationType = | 1868 WKNavigationType navigationType = |
1861 _pendingNavigationInfo ? [_pendingNavigationInfo navigationType] | 1869 _pendingNavigationInfo ? [_pendingNavigationInfo navigationType] |
1862 : WKNavigationTypeOther; | 1870 : WKNavigationTypeOther; |
1863 holder->set_back_forward_list_item([_webView backForwardList].currentItem); | 1871 holder->set_back_forward_list_item([_webView backForwardList].currentItem); |
1864 holder->set_navigation_type(navigationType); | 1872 holder->set_navigation_type(navigationType); |
1865 holder->set_http_method([_pendingNavigationInfo HTTPMethod]); | 1873 holder->set_http_method([_pendingNavigationInfo HTTPMethod]); |
(...skipping 3764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5630 } | 5638 } |
5631 | 5639 |
5632 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5640 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
5633 } | 5641 } |
5634 | 5642 |
5635 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5643 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
5636 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5644 return [action.request valueForHTTPHeaderField:@"Referer"]; |
5637 } | 5645 } |
5638 | 5646 |
5639 @end | 5647 @end |
OLD | NEW |