Skip to content
  • ap@apple.com's avatar
    Reviewed by Adele Peterson. · 383dde58
    ap@apple.com authored
            https://bugs.webkit.org/show_bug.cgi?id=28758
            <rdar://problem/6440869> Implement pageshow and pagehide events for b/f cache (28758)
    
            Tests: fast/events/pageshow-pagehide-on-back-cached.html
                   fast/events/pageshow-pagehide-on-back-uncached.html
                   fast/events/pageshow-pagehide.html
    
            * loader/FrameLoader.cpp: (WebCore::FrameLoader::stopLoading): Dispatch pagehide event
            (this function is called both when a document goes away, and when it goes to b/f cache).
    
            * page/DOMWindow.cpp:
            (WebCore::DOMWindow::dispatchAllPendingUnloadEvents): Dispatch pagehide right before unload.
            (WebCore::DOMWindow::dispatchPageTransitionEvent): Do what it takes to add a new event handler
            that can be installed on Window object.
            (WebCore::DOMWindow::onpagehide): Ditto.
            (WebCore::DOMWindow::setOnpagehide): Ditto.
            (WebCore::DOMWindow::onpageshow): Ditto.
            (WebCore::DOMWindow::setOnpageshow): Ditto.
    
            * history/CachedFrame.cpp: (WebCore::CachedFrame::restore): Dispatch pageshow for a page
            that isn't being restored from cache.
    
            * dom/PageTransitionEvent.cpp: Added.
            (WebCore::PageTransitionEvent::PageTransitionEvent):
            (WebCore::PageTransitionEvent::~PageTransitionEvent):
            (WebCore::PageTransitionEvent::initPageTransitionEvent):
            * dom/PageTransitionEvent.h: Added.
            (WebCore::PageTransitionEvent::create):
            (WebCore::PageTransitionEvent::isPageTransitionEvent):
            (WebCore::PageTransitionEvent::persisted):
            * dom/PageTransitionEvent.idl: Added.
            Add event class implementation.
    
            * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::parseMappedAttribute): Support
            inline listener definition (note that adding listeners to document.body programmatically
            is not supported, matching Firefox).
    
            * dom/Document.cpp:
            (WebCore::Document::implicitClose): Dispatch pageshow event right before load event.
            (WebCore::Document::dispatchPageTransitionEvent): Do what it takes to add a new event for
            Docuemnt.
            (WebCore::Document::createEvent): Ditto.
    
            * dom/Document.h: Added dispatchPageTransitionEvent.
    
            * DerivedSources.make:
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
            * WebCoreSources.bkl:
            * bindings/js/JSEventCustom.cpp: (WebCore::toJS):
            * dom/Event.cpp: (WebCore::Event::isPageTransitionEvent):
            * dom/Event.h:
            * dom/EventNames.h:
            * html/HTMLAttributeNames.in:
            * page/DOMWindow.h:
            * page/DOMWindow.idl:
            Do what it takes to add a new event type.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47824 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    383dde58