Changeset 54044 in webkit


Ignore:
Timestamp:
Jan 28, 2010 10:41:40 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-28 Michael Nordman <Michael Nordman>

Reviewed by Alexey Proskuryakov.

ApplicationCache events should be deferred until after Document onload has fired.
https://bugs.webkit.org/show_bug.cgi?id=29690

  • http/tests/appcache/deferred-events-expected.txt: Added.
  • http/tests/appcache/deferred-events.html: Added.
  • http/tests/appcache/deferred-events-delete-while-raising-expected.txt: Added.
  • http/tests/appcache/deferred-events-delete-while-raising.html: Added.

2010-01-28 Michael Nordman <Michael Nordman>

Reviewed by Alexey Proskuryakov.

ApplicationCache events should be deferred until after Document onload has fired.
https://bugs.webkit.org/show_bug.cgi?id=29690

Test: http/tests/appcache/deferred-events.html

  • loader/FrameLoader.cpp: (WebCore::FrameLoader::handledOnloadEvents): Tells the ApplicationCacheHost to stop deferring events.
  • loader/appcache/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true. (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event. (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
  • loader/appcache/ApplicationCacheHost.h: Declare new data members and method.

2010-01-28 Michael Nordman <Michael Nordman>

Reviewed by Alexey Proskuryakov.

ApplicationCache events should be deferred until after Document onload has fired.
https://bugs.webkit.org/show_bug.cgi?id=29690

  • src/ApplicationCacheHost.cpp: (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true. (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event. (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r54029 r54044  
     12010-01-28  Michael Nordman  <michaeln@google.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        ApplicationCache events should be deferred until after Document onload has fired.
     6        https://bugs.webkit.org/show_bug.cgi?id=29690
     7
     8        * http/tests/appcache/deferred-events-expected.txt: Added.
     9        * http/tests/appcache/deferred-events.html: Added.
     10        * http/tests/appcache/deferred-events-delete-while-raising-expected.txt: Added.
     11        * http/tests/appcache/deferred-events-delete-while-raising.html: Added.
     12
    1132010-01-28  Alex Milowski  <alex@milowski.com>
    214
  • trunk/WebCore/ChangeLog

    r54042 r54044  
     12010-01-28  Michael Nordman  <michaeln@google.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        ApplicationCache events should be deferred until after Document onload has fired.
     6        https://bugs.webkit.org/show_bug.cgi?id=29690
     7
     8        Test: http/tests/appcache/deferred-events.html
     9
     10        * loader/FrameLoader.cpp:
     11        (WebCore::FrameLoader::handledOnloadEvents):  Tells the ApplicationCacheHost to stop deferring events.
     12        * loader/appcache/ApplicationCacheHost.cpp:
     13        (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true.
     14        (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event.
     15        (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
     16        * loader/appcache/ApplicationCacheHost.h: Declare new data members and method.
     17
    1182010-01-28  Kavita Kanetkar  <kkanetkar@chromium.org>
    219
  • trunk/WebCore/loader/FrameLoader.cpp

    r53950 r54044  
    31483148{
    31493149    m_client->dispatchDidHandleOnloadEvents();
     3150#if ENABLE(OFFLINE_WEB_APPLICATIONS)
     3151    if (documentLoader())
     3152        documentLoader()->applicationCacheHost()->stopDeferringEvents();
     3153#endif
    31503154}
    31513155
  • trunk/WebCore/loader/appcache/ApplicationCacheHost.cpp

    r48701 r54044  
    4747    : m_domApplicationCache(0)
    4848    , m_documentLoader(documentLoader)
     49    , m_defersEvents(true)
    4950    , m_candidateApplicationCacheGroup(0)
    5051{
     
    230231void ApplicationCacheHost::notifyDOMApplicationCache(EventID id)
    231232{
     233    if (m_defersEvents) {
     234        // Events are deferred until document.onload has fired.
     235        m_deferredEvents.append(id);
     236        return;
     237    }
    232238    if (m_domApplicationCache) {
    233239        ExceptionCode ec = 0;
     
    235241        ASSERT(!ec);   
    236242    }
     243}
     244
     245void ApplicationCacheHost::stopDeferringEvents()
     246{
     247    RefPtr<DocumentLoader> protect(documentLoader());
     248    for (unsigned i = 0; i < m_deferredEvents.size(); ++i) {
     249        EventID id = m_deferredEvents[i];
     250        if (m_domApplicationCache) {
     251            ExceptionCode ec = 0;
     252            m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
     253            ASSERT(!ec);
     254        }
     255    }
     256    m_deferredEvents.clear();
     257    m_defersEvents = false;
    237258}
    238259
  • trunk/WebCore/loader/appcache/ApplicationCacheHost.h

    r50748 r54044  
    3434#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    3535
     36#include <wtf/Deque.h>
    3637#include <wtf/OwnPtr.h>
    3738#include <wtf/PassRefPtr.h>
     
    111112        void notifyDOMApplicationCache(EventID id);
    112113
     114        void stopDeferringEvents(); // Also raises the events that have been queued up.
     115
    113116    private:
    114117        bool isApplicationCacheEnabled();
     
    117120        DOMApplicationCache* m_domApplicationCache;
    118121        DocumentLoader* m_documentLoader;
     122        bool m_defersEvents; // Events are deferred until after document onload.
     123        Vector<EventID> m_deferredEvents;
    119124
    120125#if PLATFORM(CHROMIUM)
  • trunk/WebKit/chromium/ChangeLog

    r54015 r54044  
     12010-01-28  Michael Nordman  <michaeln@google.com>
     2
     3        Reviewed by Alexey Proskuryakov.
     4
     5        ApplicationCache events should be deferred until after Document onload has fired.
     6        https://bugs.webkit.org/show_bug.cgi?id=29690
     7
     8        * src/ApplicationCacheHost.cpp:
     9        (WebCore::ApplicationCacheHost::ApplicationCacheHost): Initialize m_isDeferringEvents to true.
     10        (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): Depending, defer or raise the event.
     11        (WebCore::ApplicationCacheHost::stopDeferringEvents): Raise any deferred events and reset the flag.
     12
    1132010-01-27  Aaron Boodman  <aa@chromium.org>
    214
  • trunk/WebKit/chromium/src/ApplicationCacheHost.cpp

    r53671 r54044  
    5656    : m_domApplicationCache(0)
    5757    , m_documentLoader(documentLoader)
     58    , m_defersEvents(true)
    5859{
    5960    ASSERT(m_documentLoader);
     
    197198void ApplicationCacheHost::notifyDOMApplicationCache(EventID id)
    198199{
     200    if (m_defersEvents) {
     201        m_deferredEvents.append(id);
     202        return;
     203    }
    199204    if (m_domApplicationCache) {
    200205        ExceptionCode ec = 0;
    201         m_domApplicationCache->dispatchEvent(
    202             Event::create(DOMApplicationCache::toEventType(id), false, false),
    203             ec);
     206        m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
    204207        ASSERT(!ec);
    205208    }
     209}
     210
     211void ApplicationCacheHost::stopDeferringEvents()
     212{
     213    RefPtr<DocumentLoader> protect(documentLoader());
     214    for (unsigned i = 0; i < m_deferredEvents.size(); ++i) {
     215        EventID id = m_deferredEvents[i];
     216        if (m_domApplicationCache) {
     217            ExceptionCode ec = 0;
     218            m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec);
     219            ASSERT(!ec);
     220        }
     221    }
     222    m_deferredEvents.clear();
     223    m_defersEvents = false;
    206224}
    207225
Note: See TracChangeset for help on using the changeset viewer.