Changeset 150688 in webkit


Ignore:
Timestamp:
May 25, 2013 10:57:19 AM (11 years ago)
Author:
mitz@apple.com
Message:

<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.
Location:
trunk/Source/WebKit/mac
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r150668 r150688  
     12013-05-25  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/13924889> -webView:didPerformClientRedirectFromURL:toURL:inFrame: should be given the redirecting URL as the “from” URL
     4        https://bugs.webkit.org/show_bug.cgi?id=116733
     5
     6        Reviewed by Adele Peterson.
     7
     8        By the time the history controller calls updateGlobalHistoryRedirectLinks(), the document
     9        loader already reflects the destination URL. In order to be able to provide the immediate
     10        source URL to the delegate, we make WebFrame track a URL and provisional URL, updating them
     11        in response to FrameLoader callbacks in exactly the same way WebFrameProxy maintains its
     12        m_url and m_provisionalURL member variables.
     13
     14        * WebCoreSupport/WebFrameLoaderClient.mm:
     15        (WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): Update
     16        provisionalURL.
     17        (WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): Update url.
     18        (WebFrameLoaderClient::dispatchDidPushStateWithinPage): Ditto.
     19        (WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): Ditto.
     20        (WebFrameLoaderClient::dispatchDidPopStateWithinPage): Ditto.
     21        (WebFrameLoaderClient::dispatchDidStartProvisionalLoad): Update provisionalURL.
     22        (WebFrameLoaderClient::dispatchDidCommitLoad): Update URL and provisionalURL.
     23        (WebFrameLoaderClient::dispatchDidFailProvisionalLoad): Clear provisionalURL.
     24        (WebFrameLoaderClient::dispatchDidFailLoad): Added an assertion.
     25        (WebFrameLoaderClient::dispatchDidFinishLoad): Ditto.
     26        (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Pass the last committed URL as the
     27        source, rather than clientRedirectSourceForHistory().
     28        * WebView/WebFrameInternal.h: Added url and provisionalURL ivars to WebFramePrivate.
     29
    1302013-05-24  Anders Carlsson  <andersca@apple.com>
    231
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r150668 r150688  
    515515void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad()
    516516{
     517    m_webFrame->_private->provisionalURL = core(m_webFrame.get())->loader()->provisionalDocumentLoader()->url().string();
     518
    517519    WebView *webView = getWebView(m_webFrame.get());
    518520    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
     
    541543void WebFrameLoaderClient::dispatchDidChangeLocationWithinPage()
    542544{
     545    m_webFrame->_private->url = core(m_webFrame.get())->document()->url().string();
     546
    543547    WebView *webView = getWebView(m_webFrame.get());
    544548    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
     
    549553void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
    550554{
     555    m_webFrame->_private->url = core(m_webFrame.get())->document()->url().string();
     556
    551557    WebView *webView = getWebView(m_webFrame.get());
    552558    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
     
    557563void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
    558564{
     565    m_webFrame->_private->url = core(m_webFrame.get())->document()->url().string();
     566
    559567    WebView *webView = getWebView(m_webFrame.get());
    560568    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
     
    565573void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
    566574{
     575    m_webFrame->_private->url = core(m_webFrame.get())->document()->url().string();
     576
    567577    WebView *webView = getWebView(m_webFrame.get());
    568578    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
     
    590600void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()
    591601{
    592     WebView *webView = getWebView(m_webFrame.get());   
     602    ASSERT(!m_webFrame->_private->provisionalURL);
     603    m_webFrame->_private->provisionalURL = core(m_webFrame.get())->loader()->provisionalDocumentLoader()->url().string();
     604
     605    WebView *webView = getWebView(m_webFrame.get());
    593606    [webView _didStartProvisionalLoadForFrame:m_webFrame.get()];
    594607
     
    620633    [webView _didCommitLoadForFrame:m_webFrame.get()];
    621634
     635    m_webFrame->_private->url = m_webFrame->_private->provisionalURL;
     636    m_webFrame->_private->provisionalURL = nullptr;
     637
    622638    WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
    623639    if (implementations->didCommitLoadForFrameFunc)
     
    627643void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
    628644{
    629     WebView *webView = getWebView(m_webFrame.get());   
     645    m_webFrame->_private->provisionalURL = nullptr;
     646
     647    WebView *webView = getWebView(m_webFrame.get());
    630648    [webView _didFailProvisionalLoadWithError:error forFrame:m_webFrame.get()];
    631649
     
    639657void WebFrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
    640658{
    641     WebView *webView = getWebView(m_webFrame.get());   
     659    ASSERT(!m_webFrame->_private->provisionalURL);
     660
     661    WebView *webView = getWebView(m_webFrame.get());
    642662    [webView _didFailLoadWithError:error forFrame:m_webFrame.get()];
    643663
     
    659679void WebFrameLoaderClient::dispatchDidFinishLoad()
    660680{
    661     WebView *webView = getWebView(m_webFrame.get());   
     681    ASSERT(!m_webFrame->_private->provisionalURL);
     682
     683    WebView *webView = getWebView(m_webFrame.get());
    662684    [webView _didFinishLoadForFrame:m_webFrame.get()];
    663685
     
    922944            if (implementations->clientRedirectFunc) {
    923945                CallHistoryDelegate(implementations->clientRedirectFunc, view, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:),
    924                     loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
     946                    m_webFrame->_private->url.get(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
    925947            }
    926948        } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
  • trunk/Source/WebKit/mac/WebView/WebFrameInternal.h

    r117771 r150688  
    8383    BOOL shouldCreateRenderers;
    8484    BOOL includedInWebKitStatistics;
     85    RetainPtr<NSString> url;
     86    RetainPtr<NSString> provisionalURL;
    8587}
    8688@end
Note: See TracChangeset for help on using the changeset viewer.