Changeset 44468 in webkit


Ignore:
Timestamp:
Jun 5, 2009 7:00:20 AM (15 years ago)
Author:
oliver@apple.com
Message:

2009-06-03 Ben Murdoch <benm@google.com>

<https://bugs.webkit.org/show_bug.cgi?id=25710> HTML5 Database stops executing transactions if the URL hash changes while a transaction is open and an XHR is in progress.

Reviewed by Alexey Proskuryakov.

Fix a bug that causes database transactions to fail if a history navigation to a hash fragment of the same document is made while resources (e.g. an XHR) are loading
https://bugs.webkit.org/show_bug.cgi?id=25710

Test: storage/hash-change-with-xhr.html

  • loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoading):
  • loader/DocumentLoader.h:
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): (WebCore::FrameLoader::stopAllLoaders):
  • loader/FrameLoader.h:
  • loader/FrameLoaderTypes.h: (WebCore::):
  • page/Page.cpp: (WebCore::Page::goToItem):
  • WebCore.base.exp:
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r44452 r44468  
     12009-06-01  Ben Murdoch  <benm@google.com>
     2
     3        <https://bugs.webkit.org/show_bug.cgi?id=25710> HTML5 Database stops executing transactions if the URL hash changes while a transaction is open and an XHR is in progress.
     4
     5        Reviewed by Alexey Proskuryakov.
     6
     7        Fix a bug that causes database transactions to fail if a history
     8        navigation to a hash fragment of the same document is made while
     9        resources (e.g. an XHR) are loading.
     10
     11        https://bugs.webkit.org/show_bug.cgi?id=25710
     12
     13        * storage/hash-change-with-xhr-expected.txt: Added.
     14        * storage/hash-change-with-xhr.html: Added.
     15
    1162009-06-03  Antti Koivisto  <antti@apple.com>
    217
  • trunk/WebCore/ChangeLog

    r44467 r44468  
     12009-06-03  Ben Murdoch  <benm@google.com>
     2
     3        <https://bugs.webkit.org/show_bug.cgi?id=25710> HTML5 Database stops executing transactions if the URL hash changes while a transaction is open and an XHR is in progress.
     4
     5        Reviewed by Alexey Proskuryakov.
     6
     7        Fix a bug that causes database transactions to fail if a history navigation to a hash fragment of the same document is made while resources (e.g. an XHR) are loading
     8
     9        Test: storage/hash-change-with-xhr.html
     10
     11        * loader/DocumentLoader.cpp:
     12        (WebCore::DocumentLoader::stopLoading):
     13        * loader/DocumentLoader.h:
     14        * loader/FrameLoader.cpp:
     15        (WebCore::FrameLoader::stopLoading):
     16        (WebCore::FrameLoader::stopAllLoaders):
     17        * loader/FrameLoader.h:
     18        * loader/FrameLoaderTypes.h:
     19        (WebCore::):
     20        * page/Page.cpp:
     21        (WebCore::Page::goToItem):
     22        * WebCore.base.exp:
     23
    1242009-06-03  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    225
  • trunk/WebCore/WebCore.base.exp

    r44452 r44468  
    156156__ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE
    157157__ZN7WebCore11FrameLoader11setEncodingERKNS_6StringEb
    158 __ZN7WebCore11FrameLoader11stopLoadingEb
     158__ZN7WebCore11FrameLoader11stopLoadingEbNS_14DatabasePolicyE
    159159__ZN7WebCore11FrameLoader12shouldReloadERKNS_4KURLES3_
    160160__ZN7WebCore11FrameLoader13executeScriptERKNS_6StringEb
    161161__ZN7WebCore11FrameLoader14detachChildrenEv
    162162__ZN7WebCore11FrameLoader14scrollToAnchorERKNS_4KURLE
    163 __ZN7WebCore11FrameLoader14stopAllLoadersEv
     163__ZN7WebCore11FrameLoader14stopAllLoadersENS_14DatabasePolicyE
    164164__ZN7WebCore11FrameLoader16detachFromParentEv
    165165__ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestEbbN3WTF10PassRefPtrINS_5EventEEENS5_INS_9FormStateEEE
  • trunk/WebCore/loader/DocumentLoader.cpp

    r44352 r44468  
    280280// stopLoading will stop all loads initiated by the data source,
    281281// but not loads initiated by child frames' data sources -- that's the WebFrame's job.
    282 void DocumentLoader::stopLoading()
     282void DocumentLoader::stopLoading(DatabasePolicy databasePolicy)
    283283{
    284284    // In some rare cases, calling FrameLoader::stopLoading could set m_loading to false.
     
    293293       
    294294        if (loading || doc->parsing())
    295             m_frame->loader()->stopLoading(false);
     295            m_frame->loader()->stopLoading(false, databasePolicy);
    296296    }
    297297
  • trunk/WebCore/loader/DocumentLoader.h

    r44352 r44468  
    9494        void replaceRequestURLForAnchorScroll(const KURL&);
    9595        bool isStopping() const { return m_isStopping; }
    96         void stopLoading();
     96        void stopLoading(DatabasePolicy = DatabasePolicyStop);
    9797        void setCommitted(bool committed) { m_committed = committed; }
    9898        bool isCommitted() const { return m_committed; }
  • trunk/WebCore/loader/FrameLoader.cpp

    r44352 r44468  
    604604}
    605605
    606 void FrameLoader::stopLoading(bool sendUnload)
     606void FrameLoader::stopLoading(bool sendUnload, DatabasePolicy databasePolicy)
    607607{
    608608    if (m_frame->document() && m_frame->document()->tokenizer())
     
    646646
    647647#if ENABLE(DATABASE)
    648         doc->stopDatabases();
     648        if (databasePolicy == DatabasePolicyStop)
     649            doc->stopDatabases();
    649650#endif
    650651    }
     
    26582659}
    26592660
    2660 void FrameLoader::stopAllLoaders()
     2661void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy)
    26612662{
    26622663    if (m_unloadEventBeingDispatched)
     
    26732674    stopLoadingSubframes();
    26742675    if (m_provisionalDocumentLoader)
    2675         m_provisionalDocumentLoader->stopLoading();
     2676        m_provisionalDocumentLoader->stopLoading(databasePolicy);
    26762677    if (m_documentLoader)
    2677         m_documentLoader->stopLoading();
     2678        m_documentLoader->stopLoading(databasePolicy);
    26782679
    26792680    setProvisionalDocumentLoader(0);
  • trunk/WebCore/loader/FrameLoader.h

    r44352 r44468  
    156156
    157157        // Also not cool.
    158         void stopAllLoaders();
     158        void stopAllLoaders(DatabasePolicy = DatabasePolicyStop);
    159159        void stopForUserCancel(bool deferCheckLoadComplete = false);
    160160
     
    265265
    266266        void stop();
    267         void stopLoading(bool sendUnload);
     267        void stopLoading(bool sendUnload, DatabasePolicy = DatabasePolicyStop);
    268268        bool closeURL();
    269269
  • trunk/WebCore/loader/FrameLoaderTypes.h

    r44352 r44468  
    6767    };
    6868
     69    enum DatabasePolicy {
     70        DatabasePolicyStop,    // The database thread should be stopped and database connections closed.
     71        DatabasePolicyContinue
     72    };
     73
    6974    enum ObjectContentType {
    7075        ObjectContentNone,
  • trunk/WebCore/page/Page.cpp

    r44352 r44468  
    202202{
    203203    // Abort any current load if we're going to a history item
    204     m_mainFrame->loader()->stopAllLoaders();
     204
     205    // Define what to do with any open database connections. By default we stop them and terminate the database thread.
     206    DatabasePolicy databasePolicy = DatabasePolicyStop;
     207
     208#if ENABLE(DATABASE)
     209    // If we're navigating the history via a fragment on the same document, then we do not want to stop databases.
     210    const KURL& currentURL = m_mainFrame->loader()->url();
     211    const KURL& newURL = item->url();
     212
     213    if (newURL.hasRef() && equalIgnoringRef(currentURL, newURL))
     214        databasePolicy = DatabasePolicyContinue;
     215#endif
     216    m_mainFrame->loader()->stopAllLoaders(databasePolicy);
    205217    m_mainFrame->loader()->goToItem(item, type);
    206218}
Note: See TracChangeset for help on using the changeset viewer.