summaryrefslogtreecommitdiffstats
path: root/WebCore/loader
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2009-12-03 09:53:55 -0800
committerGrace Kloba <klobag@google.com>2009-12-03 11:58:09 -0800
commitceb63592c5a89c8ee5e3cc6bb2186474c678fb0f (patch)
tree2746ec4fb961cea6d570fbf24718074d4c9c2e28 /WebCore/loader
parentab87fa9e3781b4b32b4c1014acd9079ea145e2d6 (diff)
downloadexternal_webkit-ceb63592c5a89c8ee5e3cc6bb2186474c678fb0f.zip
external_webkit-ceb63592c5a89c8ee5e3cc6bb2186474c678fb0f.tar.gz
external_webkit-ceb63592c5a89c8ee5e3cc6bb2186474c678fb0f.tar.bz2
Experimental change. Cache pages with unload event
for back/forward. This will improve the history navigation. But it may break some sites. See discussion in https://bugs.webkit.org/show_bug.cgi?id=29021.
Diffstat (limited to 'WebCore/loader')
-rw-r--r--WebCore/loader/FrameLoader.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index f9dc2bf..93ada45 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -530,7 +530,9 @@ void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy, DatabasePolic
if (m_frame->domWindow()) {
if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide)
m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(EventNames().pagehideEvent, m_frame->document()->inPageCache()), m_frame->document());
+#ifndef ANDROID_PAGE_CACHE_UNLOAD
if (!m_frame->document()->inPageCache())
+#endif
m_frame->domWindow()->dispatchEvent(Event::create(eventNames().unloadEvent, false, false), m_frame->domWindow()->document());
}
m_unloadEventBeingDispatched = false;
@@ -1523,7 +1525,9 @@ bool FrameLoader::canCachePageContainingThisFrame()
// the right NPObjects. See <rdar://problem/5197041> for more information.
&& !m_containsPlugIns
&& !m_URL.protocolIs("https")
+#ifndef ANDROID_PAGE_CACHE_UNLOAD
&& (!m_frame->domWindow() || !m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent))
+#endif
#if ENABLE(DATABASE)
&& !m_frame->document()->hasOpenDatabases()
#endif
@@ -1668,8 +1672,10 @@ bool FrameLoader::logCanCacheFrameDecision(int indentLevel)
{ PCLOG(" -Frame contains plugins"); cannotCache = true; }
if (m_URL.protocolIs("https"))
{ PCLOG(" -Frame is HTTPS"); cannotCache = true; }
+#ifndef ANDROID_PAGE_CACHE_UNLOAD
if (m_frame->domWindow() && m_frame->domWindow()->hasEventListeners(eventNames().unloadEvent))
{ PCLOG(" -Frame has an unload event listener"); cannotCache = true; }
+#endif
#if ENABLE(DATABASE)
if (m_frame->document()->hasOpenDatabases())
{ PCLOG(" -Frame has open database handles"); cannotCache = true; }