| Differences between
and this patch
- WebCore/ChangeLog +24 lines
Lines 1-3 WebCore/ChangeLog_sec1
1
2009-09-02  Brady Eidson  <beidson@apple.com>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        More partial work towards "Page Cache should support pages with Frames"
6
        https://bugs.webkit.org/show_bug.cgi?id=13631
7
8
        No new tests. (No change in behavior, current tests pass).
9
10
        * loader/DocumentLoader.cpp:
11
        (WebCore::DocumentLoader::stopLoading): Adopt the new enum form for FrameLoader::stopLoading().
12
13
        * loader/FrameLoader.cpp:
14
        (WebCore::FrameLoader::stopLoading): Take an enum to decide whether to dispatch no unload events,
15
          only unload, or unload and pagehide.
16
        (WebCore::FrameLoader::closeURL):
17
        (WebCore::FrameLoader::scheduleRedirection):
18
        (WebCore::FrameLoader::cachePageForHistoryItem): Call pageHidden().
19
        (WebCore::FrameLoader::pageHidden): Add to dispatch the pagehide event to all frames in the case
20
          where a page is added to the PageCache.
21
        * loader/FrameLoader.h:
22
23
        * loader/FrameLoaderTypes.h: Add an UnloadEventPolicy enum.
24
1
2009-09-02  Brady Eidson  <beidson@apple.com>
25
2009-09-02  Brady Eidson  <beidson@apple.com>
2
26
3
        Reviewed by Darin Adler.
27
        Reviewed by Darin Adler.
- WebCore/loader/DocumentLoader.cpp -1 / +1 lines
Lines 273-279 void DocumentLoader::stopLoading(Databas WebCore/loader/DocumentLoader.cpp_sec1
273
        Document* doc = m_frame->document();
273
        Document* doc = m_frame->document();
274
        
274
        
275
        if (loading || doc->parsing())
275
        if (loading || doc->parsing())
276
            m_frame->loader()->stopLoading(false, databasePolicy);
276
            m_frame->loader()->stopLoading(UnloadEventPolicyNone, databasePolicy);
277
    }
277
    }
278
278
279
    // Always cancel multipart loaders
279
    // Always cancel multipart loaders
- WebCore/loader/FrameLoader.cpp -6 / +25 lines
Lines 563-574 void FrameLoader::submitForm(const char* WebCore/loader/FrameLoader.cpp_sec1
563
    targetFrame->loader()->scheduleFormSubmission(frameRequest, lockHistory, event, formState);
563
    targetFrame->loader()->scheduleFormSubmission(frameRequest, lockHistory, event, formState);
564
}
564
}
565
565
566
void FrameLoader::stopLoading(bool sendUnload, DatabasePolicy databasePolicy)
566
void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolicy databasePolicy)
567
{
567
{
568
    if (m_frame->document() && m_frame->document()->tokenizer())
568
    if (m_frame->document() && m_frame->document()->tokenizer())
569
        m_frame->document()->tokenizer()->stopParsing();
569
        m_frame->document()->tokenizer()->stopParsing();
570
570
571
    if (sendUnload) {
571
    if (unloadEventPolicy != UnloadEventPolicyNone) {
572
        if (m_frame->document()) {
572
        if (m_frame->document()) {
573
            if (m_didCallImplicitClose && !m_wasUnloadEventEmitted) {
573
            if (m_didCallImplicitClose && !m_wasUnloadEventEmitted) {
574
                Node* currentFocusedNode = m_frame->document()->focusedNode();
574
                Node* currentFocusedNode = m_frame->document()->focusedNode();
Lines 576-582 void FrameLoader::stopLoading(bool sendU WebCore/loader/FrameLoader.cpp_sec2
576
                    currentFocusedNode->aboutToUnload();
576
                    currentFocusedNode->aboutToUnload();
577
                m_unloadEventBeingDispatched = true;
577
                m_unloadEventBeingDispatched = true;
578
                if (m_frame->domWindow()) {
578
                if (m_frame->domWindow()) {
579
                    m_frame->domWindow()->dispatchPageTransitionEvent(EventNames().pagehideEvent, m_frame->document()->inPageCache());
579
                    if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide)
580
                        m_frame->domWindow()->dispatchPageTransitionEvent(EventNames().pagehideEvent, m_frame->document()->inPageCache());
580
                    m_frame->domWindow()->dispatchUnloadEvent();
581
                    m_frame->domWindow()->dispatchUnloadEvent();
581
                }
582
                }
582
                m_unloadEventBeingDispatched = false;
583
                m_unloadEventBeingDispatched = false;
Lines 614-620 void FrameLoader::stopLoading(bool sendU WebCore/loader/FrameLoader.cpp_sec3
614
615
615
    // tell all subframes to stop as well
616
    // tell all subframes to stop as well
616
    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
617
    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
617
        child->loader()->stopLoading(sendUnload);
618
        child->loader()->stopLoading(unloadEventPolicy);
618
619
619
    cancelRedirection();
620
    cancelRedirection();
620
}
621
}
Lines 636-642 void FrameLoader::stop() WebCore/loader/FrameLoader.cpp_sec4
636
bool FrameLoader::closeURL()
637
bool FrameLoader::closeURL()
637
{
638
{
638
    saveDocumentState();
639
    saveDocumentState();
639
    stopLoading(true);
640
    
641
    // Should only send the pagehide event here if the current document exists and has not been placed in the page cache.    
642
    Document* currentDocument = m_frame->document();
643
    stopLoading(currentDocument && !currentDocument->inPageCache() ? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly);
644
    
640
    m_frame->editor()->clearUndoRedoOperations();
645
    m_frame->editor()->clearUndoRedoOperations();
641
    return true;
646
    return true;
642
}
647
}
Lines 2081-2087 void FrameLoader::scheduleRedirection(Sc WebCore/loader/FrameLoader.cpp_sec5
2081
    if (redirection->wasDuringLoad) {
2086
    if (redirection->wasDuringLoad) {
2082
        if (m_provisionalDocumentLoader)
2087
        if (m_provisionalDocumentLoader)
2083
            m_provisionalDocumentLoader->stopLoading();
2088
            m_provisionalDocumentLoader->stopLoading();
2084
        stopLoading(true);   
2089
        stopLoading(UnloadEventPolicyUnloadAndPageHide);   
2085
    }
2090
    }
2086
2091
2087
    stopRedirectionTimer();
2092
    stopRedirectionTimer();
Lines 4233-4244 void FrameLoader::cachePageForHistoryIte WebCore/loader/FrameLoader.cpp_sec6
4233
    if (!canCachePage() || item->isInPageCache())
4238
    if (!canCachePage() || item->isInPageCache())
4234
        return;
4239
        return;
4235
4240
4241
    pageHidden();
4242
    
4236
    if (Page* page = m_frame->page()) {
4243
    if (Page* page = m_frame->page()) {
4237
        RefPtr<CachedPage> cachedPage = CachedPage::create(page);
4244
        RefPtr<CachedPage> cachedPage = CachedPage::create(page);
4238
        pageCache()->add(item, cachedPage.release());
4245
        pageCache()->add(item, cachedPage.release());
4239
    }
4246
    }
4240
}
4247
}
4241
4248
4249
void FrameLoader::pageHidden()
4250
{
4251
    m_unloadEventBeingDispatched = true;
4252
    if (m_frame->domWindow())
4253
        m_frame->domWindow()->dispatchPageTransitionEvent(EventNames().pagehideEvent, true);
4254
    m_unloadEventBeingDispatched = false;
4255
4256
    // Send pagehide event for subframes as well
4257
    for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
4258
        child->loader()->pageHidden();
4259
}
4260
4242
bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const
4261
bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const
4243
{
4262
{
4244
    if (!m_currentHistoryItem)
4263
    if (!m_currentHistoryItem)
- WebCore/loader/FrameLoader.h -1 / +2 lines
Lines 261-267 namespace WebCore { WebCore/loader/FrameLoader.h_sec1
261
            bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>);
261
            bool lockHistory, PassRefPtr<Event>, PassRefPtr<FormState>);
262
262
263
        void stop();
263
        void stop();
264
        void stopLoading(bool sendUnload, DatabasePolicy = DatabasePolicyStop);
264
        void stopLoading(UnloadEventPolicy, DatabasePolicy = DatabasePolicyStop);
265
        bool closeURL();
265
        bool closeURL();
266
266
267
        void didExplicitOpen();
267
        void didExplicitOpen();
Lines 422-427 namespace WebCore { WebCore/loader/FrameLoader.h_sec2
422
        
422
        
423
        bool loadProvisionalItemFromCachedPage();
423
        bool loadProvisionalItemFromCachedPage();
424
        void cachePageForHistoryItem(HistoryItem*);
424
        void cachePageForHistoryItem(HistoryItem*);
425
        void pageHidden();
425
426
426
        void receivedFirstData();
427
        void receivedFirstData();
427
428
- WebCore/loader/FrameLoaderTypes.h +6 lines
Lines 81-86 namespace WebCore { WebCore/loader/FrameLoaderTypes.h_sec1
81
        ObjectContentNetscapePlugin,
81
        ObjectContentNetscapePlugin,
82
        ObjectContentOtherPlugin
82
        ObjectContentOtherPlugin
83
    };
83
    };
84
    
85
    enum UnloadEventPolicy {
86
        UnloadEventPolicyNone,
87
        UnloadEventPolicyUnloadOnly,
88
        UnloadEventPolicyUnloadAndPageHide
89
    };
84
}
90
}
85
91
86
#endif
92
#endif

Return to Bug 13631