Modified: trunk/Source/WebKit/mac/ChangeLog (150687 => 150688)
--- trunk/Source/WebKit/mac/ChangeLog 2013-05-25 12:02:35 UTC (rev 150687)
+++ trunk/Source/WebKit/mac/ChangeLog 2013-05-25 17:57:19 UTC (rev 150688)
@@ -1,3 +1,32 @@
+2013-05-25 Dan Bernstein <m...@apple.com>
+
+ <rdar://problem/13924889> -webView:didPerformClientRedirectFromURL:toURL:inFrame: should be given the redirecting URL as the “from” URL
+ https://bugs.webkit.org/show_bug.cgi?id=116733
+
+ Reviewed by Adele Peterson.
+
+ By the time the history controller calls updateGlobalHistoryRedirectLinks(), the document
+ loader already reflects the destination URL. In order to be able to provide the immediate
+ source URL to the delegate, we make WebFrame track a URL and provisional URL, updating them
+ in response to FrameLoader callbacks in exactly the same way WebFrameProxy maintains its
+ m_url and m_provisionalURL member variables.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): Update
+ provisionalURL.
+ (WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): Update url.
+ (WebFrameLoaderClient::dispatchDidPushStateWithinPage): Ditto.
+ (WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): Ditto.
+ (WebFrameLoaderClient::dispatchDidPopStateWithinPage): Ditto.
+ (WebFrameLoaderClient::dispatchDidStartProvisionalLoad): Update provisionalURL.
+ (WebFrameLoaderClient::dispatchDidCommitLoad): Update URL and provisionalURL.
+ (WebFrameLoaderClient::dispatchDidFailProvisionalLoad): Clear provisionalURL.
+ (WebFrameLoaderClient::dispatchDidFailLoad): Added an assertion.
+ (WebFrameLoaderClient::dispatchDidFinishLoad): Ditto.
+ (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Pass the last committed URL as the
+ source, rather than clientRedirectSourceForHistory().
+ * WebView/WebFrameInternal.h: Added url and provisionalURL ivars to WebFramePrivate.
+
2013-05-24 Anders Carlsson <ander...@apple.com>
Remove using namespace std from Mac WebKit1
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (150687 => 150688)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2013-05-25 12:02:35 UTC (rev 150687)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2013-05-25 17:57:19 UTC (rev 150688)
@@ -514,6 +514,8 @@
void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
{
+ m_webFrame->_private->provisionalURL = core(m_webFrame.get())->loader()->provisionalDocumentLoader()->url().string();
+
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didReceiveServerRedirectForProvisionalLoadForFrameFunc)
@@ -540,6 +542,8 @@
void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage()
{
+ m_webFrame->_private->url = ""
+
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didChangeLocationWithinPageForFrameFunc)
@@ -548,6 +552,8 @@
void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
{
+ m_webFrame->_private->url = ""
+
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didPushStateWithinPageForFrameFunc)
@@ -556,6 +562,8 @@
void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
{
+ m_webFrame->_private->url = ""
+
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didReplaceStateWithinPageForFrameFunc)
@@ -564,6 +572,8 @@
void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
{
+ m_webFrame->_private->url = ""
+
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didPopStateWithinPageForFrameFunc)
@@ -589,7 +599,10 @@
void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
{
- WebView *webView = getWebView(m_webFrame.get());
+ ASSERT(!m_webFrame->_private->provisionalURL);
+ m_webFrame->_private->provisionalURL = core(m_webFrame.get())->loader()->provisionalDocumentLoader()->url().string();
+
+ WebView *webView = getWebView(m_webFrame.get());
[webView _didStartProvisionalLoadForFrame:m_webFrame.get()];
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
@@ -619,6 +632,9 @@
WebView *webView = getWebView(m_webFrame.get());
[webView _didCommitLoadForFrame:m_webFrame.get()];
+ m_webFrame->_private->url = ""
+ m_webFrame->_private->provisionalURL = nullptr;
+
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didCommitLoadForFrameFunc)
CallFrameLoadDelegate(implementations->didCommitLoadForFrameFunc, webView, @selector(webView:didCommitLoadForFrame:), m_webFrame.get());
@@ -626,7 +642,9 @@
void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
{
- WebView *webView = getWebView(m_webFrame.get());
+ m_webFrame->_private->provisionalURL = nullptr;
+
+ WebView *webView = getWebView(m_webFrame.get());
[webView _didFailProvisionalLoadWithError:error forFrame:m_webFrame.get()];
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
@@ -638,7 +656,9 @@
void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
{
- WebView *webView = getWebView(m_webFrame.get());
+ ASSERT(!m_webFrame->_private->provisionalURL);
+
+ WebView *webView = getWebView(m_webFrame.get());
[webView _didFailLoadWithError:error forFrame:m_webFrame.get()];
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
@@ -658,7 +678,9 @@
void WebFrameLoaderClient::dispatchDidFinishLoad()
{
- WebView *webView = getWebView(m_webFrame.get());
+ ASSERT(!m_webFrame->_private->provisionalURL);
+
+ WebView *webView = getWebView(m_webFrame.get());
[webView _didFinishLoadForFrame:m_webFrame.get()];
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
@@ -921,7 +943,7 @@
if (implementations) {
if (implementations->clientRedirectFunc) {
CallHistoryDelegate(implementations->clientRedirectFunc, view, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:),
- loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
+ m_webFrame->_private->url.get(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
}
} else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
core(item)->addRedirectURL(loader->clientRedirectDestinationForHistory());
Modified: trunk/Source/WebKit/mac/WebView/WebFrameInternal.h (150687 => 150688)
--- trunk/Source/WebKit/mac/WebView/WebFrameInternal.h 2013-05-25 12:02:35 UTC (rev 150687)
+++ trunk/Source/WebKit/mac/WebView/WebFrameInternal.h 2013-05-25 17:57:19 UTC (rev 150688)
@@ -82,6 +82,8 @@
id internalLoadDelegate;
BOOL shouldCreateRenderers;
BOOL includedInWebKitStatistics;
+ RetainPtr<NSString> url;
+ RetainPtr<NSString> provisionalURL;
}
@end