Changeset 171574 in webkit


Ignore:
Timestamp:
Jul 24, 2014 6:31:40 PM (10 years ago)
Author:
mitz@apple.com
Message:

Source/WebCore: WebCore part of <rdar://problem/17593701> Assertion failure in WebPage::reload (!m_pendingNavigationID) when reloading after a same-document back navigation
https://bugs.webkit.org/show_bug.cgi?id=135129

Reviewed by Darin Adler.

  • WebCore.exp.in: Exported equalIgnoringFragmentIdentifier(const URL&, const URL&).

Source/WebKit2: WebKit2 part of <rdar://problem/17593701> Assertion failure in WebPage::reload (!m_pendingNavigationID) when reloading after a same-document back navigation
https://bugs.webkit.org/show_bug.cgi?id=135129

Reviewed by Darin Adler.

  • Shared/WebBackForwardListItem.cpp:

(WebKit::childItemWithDocumentSequenceNumber): New helper function based on
WebCore::HistoryItem::childItemWithDocumentSequenceNumber.
(WebKit::documentTreesAreEqual): New helper function based on
WebCore::HistoryItem::hasSameDocumentTree.
(WebKit::WebBackForwardListItem::itemIsInSameDocument): Added. Based on
WebCore::HistoryItem::shouldDoSameDocumentNavigationTo.

  • Shared/WebBackForwardListItem.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::goForward): Don’t assign a new navigation ID if the back-forward
navigation is a same-document navigation.
(WebKit::WebPageProxy::goBack): Ditto.
(WebKit::WebPageProxy::goToBackForwardItem): Ditto.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r171567 r171574  
     12014-07-24  Dan Bernstein  <mitz@apple.com>
     2
     3        WebCore part of <rdar://problem/17593701> Assertion failure in WebPage::reload (!m_pendingNavigationID) when reloading after a same-document back navigation
     4        https://bugs.webkit.org/show_bug.cgi?id=135129
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCore.exp.in: Exported equalIgnoringFragmentIdentifier(const URL&, const URL&).
     9
    1102014-07-24  Simon Fraser  <simon.fraser@apple.com>
    211
  • trunk/Source/WebCore/WebCore.exp.in

    r171540 r171574  
    10601060__ZN7WebCore31CrossOriginPreflightResultCache5emptyEv
    10611061__ZN7WebCore31CrossOriginPreflightResultCache6sharedEv
     1062__ZN7WebCore31equalIgnoringFragmentIdentifierERKNS_3URLES2_
    10621063__ZN7WebCore33deleteAllCookiesModifiedAfterDateERKNS_21NetworkStorageSessionEd
    10631064__ZN7WebCore33stripLeadingAndTrailingHTMLSpacesERKN3WTF6StringE
  • trunk/Source/WebKit2/ChangeLog

    r171570 r171574  
     12014-07-24  Dan Bernstein  <mitz@apple.com>
     2
     3        WebKit2 part of <rdar://problem/17593701> Assertion failure in WebPage::reload (!m_pendingNavigationID) when reloading after a same-document back navigation
     4        https://bugs.webkit.org/show_bug.cgi?id=135129
     5
     6        Reviewed by Darin Adler.
     7
     8        * Shared/WebBackForwardListItem.cpp:
     9        (WebKit::childItemWithDocumentSequenceNumber): New helper function based on
     10        WebCore::HistoryItem::childItemWithDocumentSequenceNumber.
     11        (WebKit::documentTreesAreEqual): New helper function based on
     12        WebCore::HistoryItem::hasSameDocumentTree.
     13        (WebKit::WebBackForwardListItem::itemIsInSameDocument): Added. Based on
     14        WebCore::HistoryItem::shouldDoSameDocumentNavigationTo.
     15        * Shared/WebBackForwardListItem.h:
     16
     17        * UIProcess/WebPageProxy.cpp:
     18        (WebKit::WebPageProxy::goForward): Don’t assign a new navigation ID if the back-forward
     19        navigation is a same-document navigation.
     20        (WebKit::WebPageProxy::goBack): Ditto.
     21        (WebKit::WebPageProxy::goToBackForwardItem): Ditto.
     22
    1232014-07-24  Tim Horton  <timothy_horton@apple.com>
    224
  • trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp

    r170902 r171574  
    2727#include "WebBackForwardListItem.h"
    2828
     29#include <WebCore/URL.h>
     30
    2931namespace WebKit {
    3032
     
    4850}
    4951
     52static const FrameState* childItemWithDocumentSequenceNumber(const FrameState& frameState, int64_t number)
     53{
     54    for (const auto& child : frameState.children) {
     55        if (child.documentSequenceNumber == number)
     56            return &child;
     57    }
     58
     59    return nullptr;
     60}
     61
     62static bool documentTreesAreEqual(const FrameState& a, const FrameState& b)
     63{
     64    if (a.documentSequenceNumber != b.documentSequenceNumber)
     65        return false;
     66
     67    if (a.children.size() != b.children.size())
     68        return false;
     69
     70    for (const auto& child : a.children) {
     71        const FrameState* otherChild = childItemWithDocumentSequenceNumber(b, child.documentSequenceNumber);
     72        if (!otherChild || !documentTreesAreEqual(child, *otherChild))
     73            return false;
     74    }
     75
     76    return true;
     77}
     78
     79bool WebBackForwardListItem::itemIsInSameDocument(const WebBackForwardListItem& other) const
     80{
     81    if (m_pageID != other.m_pageID)
     82        return false;
     83
     84    // The following logic must be kept in sync with WebCore::HistoryItem::shouldDoSameDocumentNavigationTo.
     85
     86    const FrameState& mainFrameState = m_itemState.pageState.mainFrameState;
     87    const FrameState& otherMainFrameState = other.m_itemState.pageState.mainFrameState;
     88
     89    if (mainFrameState.stateObjectData || otherMainFrameState.stateObjectData)
     90        return mainFrameState.documentSequenceNumber == otherMainFrameState.documentSequenceNumber;
     91
     92    WebCore::URL url = WebCore::URL(WebCore::ParsedURLString, mainFrameState.urlString);
     93    WebCore::URL otherURL = WebCore::URL(WebCore::ParsedURLString, otherMainFrameState.urlString);
     94
     95    if ((url.hasFragmentIdentifier() || otherURL.hasFragmentIdentifier()) && equalIgnoringFragmentIdentifier(url, otherURL))
     96        return mainFrameState.documentSequenceNumber == otherMainFrameState.documentSequenceNumber;
     97
     98    return documentTreesAreEqual(mainFrameState, otherMainFrameState);
     99}
     100
    50101uint64_t WebBackForwardListItem::highedUsedItemID()
    51102{
  • trunk/Source/WebKit2/Shared/WebBackForwardListItem.h

    r170989 r171574  
    5858    const String& title() const { return m_itemState.pageState.title; }
    5959
     60    bool itemIsInSameDocument(const WebBackForwardListItem&) const;
     61
    6062#if PLATFORM(COCOA)
    6163    ViewSnapshot* snapshot() const { return m_itemState.snapshot.get(); }
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r171570 r171574  
    901901        return reattachToWebProcessWithItem(forwardItem);
    902902
    903     uint64_t navigationID = generateNavigationID();
     903    uint64_t navigationID = m_backForwardList->currentItem()->itemIsInSameDocument(*forwardItem) ? 0 : generateNavigationID();
    904904
    905905    m_process->send(Messages::WebPage::GoForward(navigationID, forwardItem->itemID()), m_pageID);
     
    922922        return reattachToWebProcessWithItem(backItem);
    923923
    924     uint64_t navigationID = generateNavigationID();
     924    uint64_t navigationID = m_backForwardList->currentItem()->itemIsInSameDocument(*backItem) ? 0 : generateNavigationID();
    925925
    926926    m_process->send(Messages::WebPage::GoBack(navigationID, backItem->itemID()), m_pageID);
     
    939939    m_pageLoadState.setPendingAPIRequestURL(transaction, item->url());
    940940
    941     uint64_t navigationID = generateNavigationID();
     941    uint64_t navigationID = m_backForwardList->currentItem()->itemIsInSameDocument(*item) ? 0 : generateNavigationID();
    942942
    943943    m_process->send(Messages::WebPage::GoToBackForwardItem(navigationID, item->itemID()), m_pageID);
Note: See TracChangeset for help on using the changeset viewer.