Title: [173336] trunk
Revision
173336
Author
beid...@apple.com
Date
2014-09-05 15:11:16 -0700 (Fri, 05 Sep 2014)

Log Message

Allow pages with unload handlers in the page cache
<rdar://problem/11084669> and https://bugs.webkit.org/show_bug.cgi?id=136535

Reviewed by Oliver Hunt.

Source/WebCore:

This will match what iOS has been doing for some time.

Updated tests for new behavior.

* history/PageCache.cpp:
(WebCore::logCanCacheFrameDecision):
(WebCore::PageCache::canCachePageContainingThisFrame):

LayoutTests:

* fast/frames/frame-crash-with-page-cache-expected.txt:
* fast/frames/resources/cached-page-1.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (173335 => 173336)


--- trunk/LayoutTests/ChangeLog	2014-09-05 22:09:41 UTC (rev 173335)
+++ trunk/LayoutTests/ChangeLog	2014-09-05 22:11:16 UTC (rev 173336)
@@ -1,3 +1,13 @@
+2014-09-05  Brady Eidson  <beid...@apple.com>
+
+        Allow pages with unload handlers in the page cache
+        <rdar://problem/11084669> and https://bugs.webkit.org/show_bug.cgi?id=136535
+
+        Reviewed by Oliver Hunt.
+
+        * fast/frames/frame-crash-with-page-cache-expected.txt:
+        * fast/frames/resources/cached-page-1.html:
+
 2014-09-05  Roger Fong  <roger_f...@apple.com>
 
         Remove statically used varyings from packing restrictions check.

Modified: trunk/LayoutTests/fast/frames/frame-crash-with-page-cache-expected.txt (173335 => 173336)


--- trunk/LayoutTests/fast/frames/frame-crash-with-page-cache-expected.txt	2014-09-05 22:09:41 UTC (rev 173335)
+++ trunk/LayoutTests/fast/frames/frame-crash-with-page-cache-expected.txt	2014-09-05 22:11:16 UTC (rev 173336)
@@ -1,9 +1,6 @@
-main frame - has 1 onunload handler(s)
-main frame - has 1 onunload handler(s)
 If WebKit does not assert or crash, you passed.
 open page-1
 page-1, about to navigate to page-2.
-page-1 running unload handler
 page-2, about to navigate to page-3.
 On page-3, going back, now.
 Back on page-2, timer is still firing.

Modified: trunk/LayoutTests/fast/frames/resources/cached-page-1.html (173335 => 173336)


--- trunk/LayoutTests/fast/frames/resources/cached-page-1.html	2014-09-05 22:09:41 UTC (rev 173335)
+++ trunk/LayoutTests/fast/frames/resources/cached-page-1.html	2014-09-05 22:11:16 UTC (rev 173336)
@@ -17,13 +17,8 @@
     setTimeout(function() {location.href = "" 0);
 }
 
-// This unload handler exists just to make sure this page is not added
-// to the page cache!
-function myUnload() {
-    window.opener.log("page-1 running unload handler");
-}
 </script>
 </head>
-<body _onload_="loadNext()" _onunload_="myUnload()">
+<body _onpageshow_="loadNext()">
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (173335 => 173336)


--- trunk/Source/WebCore/ChangeLog	2014-09-05 22:09:41 UTC (rev 173335)
+++ trunk/Source/WebCore/ChangeLog	2014-09-05 22:11:16 UTC (rev 173336)
@@ -1,3 +1,18 @@
+2014-09-05  Brady Eidson  <beid...@apple.com>
+
+        Allow pages with unload handlers in the page cache
+        <rdar://problem/11084669> and https://bugs.webkit.org/show_bug.cgi?id=136535
+
+        Reviewed by Oliver Hunt.
+
+        This will match what iOS has been doing for some time.
+
+        Updated tests for new behavior.
+
+        * history/PageCache.cpp:
+        (WebCore::logCanCacheFrameDecision):
+        (WebCore::PageCache::canCachePageContainingThisFrame):
+
 2014-09-05  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [SOUP] Implement ResourceResponse::platformSuggestedFilename() when USE(SOUP) is enabled.

Modified: trunk/Source/WebCore/history/PageCache.cpp (173335 => 173336)


--- trunk/Source/WebCore/history/PageCache.cpp	2014-09-05 22:09:41 UTC (rev 173335)
+++ trunk/Source/WebCore/history/PageCache.cpp	2014-09-05 22:11:16 UTC (rev 173336)
@@ -75,7 +75,6 @@
     IsErrorPage,
     HasPlugins,
     IsHttpsAndCacheControlled,
-    HasUnloadListener,
     HasDatabaseHandles,
     HasSharedWorkers,
     NoHistoryItem,
@@ -130,15 +129,6 @@
         PCLOG("   -Frame is HTTPS, and cache control prohibits caching or storing");
         rejectReasons |= 1 << IsHttpsAndCacheControlled;
     }
-    if (frame->document()->domWindow() && frame->document()->domWindow()->hasEventListeners(eventNames().unloadEvent)) {
-        PCLOG("   -Frame has an unload event listener");
-#if !PLATFORM(IOS)
-        rejectReasons |= 1 << HasUnloadListener;
-#else
-        // iOS allows pages with unload event listeners to enter the page cache.
-        PCLOG("    -BUT iOS allows these pages to be cached.");
-#endif
-    }
 #if ENABLE(SQL_DATABASE)
     if (DatabaseManager::manager().hasOpenDatabases(frame->document())) {
         PCLOG("   -Frame has open database handles");
@@ -296,9 +286,6 @@
         && !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
         && (!frameLoader.subframeLoader().containsPlugins() || frame->page()->settings().pageCacheSupportsPlugins())
         && (!document->url().protocolIs("https") || (!documentLoader->response().cacheControlContainsNoCache() && !documentLoader->response().cacheControlContainsNoStore()))
-#if !PLATFORM(IOS)
-        && (!document->domWindow() || !document->domWindow()->hasEventListeners(eventNames().unloadEvent))
-#endif
 #if ENABLE(SQL_DATABASE)
         && !DatabaseManager::manager().hasOpenDatabases(document)
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to