Title: [117112] trunk
Revision
117112
Author
[email protected]
Date
2012-05-15 12:05:52 -0700 (Tue, 15 May 2012)

Log Message

WKContextSetCacheModel(contextref, kWKCacheModelDocumentViewer) doesn't prevent pages from
going into the PageCache.
https://bugs.webkit.org/show_bug.cgi?id=85891

Reviewed by Brady Eidson.

Source/WebCore:

Do not claim that it is possible to cache a page when the page cache has a capacity of 0.

Covered by the modified DOMWindowExtensionNoCache WK2 API test.

* history/PageCache.cpp:
(WebCore::PageCache::canCache):
Check m_capacity.
* history/PageCache.h:

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):
canCache is no longer static on PageCache.

Tools:

Set the cache model in DOMWindowExtensionNoCache so that the page cache is not used. This is
better than using pages with unload handlers because we may find a way to make pages with
unload handlers cacheable in the future.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Remove simple-iframe-unload.html and simple-unload.html, since they are no longer used.

* TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionNoCache.cpp:
(TestWebKitAPI::TEST):
Set the cache model to kWKCacheModelDocumentViewer.

* TestWebKitAPI/Tests/WebKit2/simple-iframe-unload.html: Removed.
* TestWebKitAPI/Tests/WebKit2/simple-unload.html: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117111 => 117112)


--- trunk/Source/WebCore/ChangeLog	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Source/WebCore/ChangeLog	2012-05-15 19:05:52 UTC (rev 117112)
@@ -1,3 +1,24 @@
+2012-05-15  Jessie Berlin  <[email protected]>
+
+        WKContextSetCacheModel(contextref, kWKCacheModelDocumentViewer) doesn't prevent pages from
+        going into the PageCache.
+        https://bugs.webkit.org/show_bug.cgi?id=85891
+
+        Reviewed by Brady Eidson.
+
+        Do not claim that it is possible to cache a page when the page cache has a capacity of 0.
+
+        Covered by the modified DOMWindowExtensionNoCache WK2 API test.
+
+        * history/PageCache.cpp:
+        (WebCore::PageCache::canCache):
+        Check m_capacity.
+        * history/PageCache.h:
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        canCache is no longer static on PageCache.
+
 2012-05-15  James Robinson  <[email protected]>
 
         Unreviewed, rolling out r116811.

Modified: trunk/Source/WebCore/history/PageCache.cpp (117111 => 117112)


--- trunk/Source/WebCore/history/PageCache.cpp	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Source/WebCore/history/PageCache.cpp	2012-05-15 19:05:52 UTC (rev 117112)
@@ -361,7 +361,7 @@
         && frameLoader->client()->canCachePage();
 }
     
-bool PageCache::canCache(Page* page)
+bool PageCache::canCache(Page* page) const
 {
     if (!page)
         return false;
@@ -377,7 +377,8 @@
     // over it again when we leave that page.
     FrameLoadType loadType = page->mainFrame()->loader()->loadType();
     
-    return canCachePageContainingThisFrame(page->mainFrame())
+    return m_capacity > 0
+        && canCachePageContainingThisFrame(page->mainFrame())
         && page->backForward()->isActive()
         && page->settings()->usesPageCache()
 #if ENABLE(DEVICE_ORIENTATION)

Modified: trunk/Source/WebCore/history/PageCache.h (117111 => 117112)


--- trunk/Source/WebCore/history/PageCache.h	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Source/WebCore/history/PageCache.h	2012-05-15 19:05:52 UTC (rev 117112)
@@ -43,7 +43,7 @@
     public:
         friend PageCache* pageCache();
         
-        static bool canCache(Page*);
+        bool canCache(Page*) const;
 
         void setCapacity(int); // number of pages to cache
         int capacity() { return m_capacity; }

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (117111 => 117112)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-05-15 19:05:52 UTC (rev 117112)
@@ -1632,7 +1632,7 @@
     // Check to see if we need to cache the page we are navigating away from into the back/forward cache.
     // We are doing this here because we know for sure that a new page is about to be loaded.
     HistoryItem* item = history()->currentItem();
-    if (!m_frame->tree()->parent() && PageCache::canCache(m_frame->page()) && !item->isInPageCache())
+    if (!m_frame->tree()->parent() && pageCache()->canCache(m_frame->page()) && !item->isInPageCache())
         pageCache()->add(item, m_frame->page());
 
     if (m_loadType != FrameLoadTypeReplace)

Modified: trunk/Tools/ChangeLog (117111 => 117112)


--- trunk/Tools/ChangeLog	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Tools/ChangeLog	2012-05-15 19:05:52 UTC (rev 117112)
@@ -1,3 +1,25 @@
+2012-05-15  Jessie Berlin  <[email protected]>
+
+        WKContextSetCacheModel(contextref, kWKCacheModelDocumentViewer) doesn't prevent pages from
+        going into the PageCache.
+        https://bugs.webkit.org/show_bug.cgi?id=85891
+
+        Reviewed by Brady Eidson.
+
+        Set the cache model in DOMWindowExtensionNoCache so that the page cache is not used. This is
+        better than using pages with unload handlers because we may find a way to make pages with
+        unload handlers cacheable in the future.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        Remove simple-iframe-unload.html and simple-unload.html, since they are no longer used.
+
+        * TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionNoCache.cpp:
+        (TestWebKitAPI::TEST):
+        Set the cache model to kWKCacheModelDocumentViewer.
+
+        * TestWebKitAPI/Tests/WebKit2/simple-iframe-unload.html: Removed.
+        * TestWebKitAPI/Tests/WebKit2/simple-unload.html: Removed.
+
 2012-05-15  Kenneth Rohde Christiansen  <[email protected]>
 
         [Qt] Add infra for testing double-tap to zoom functionality etc

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (117111 => 117112)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2012-05-15 19:05:52 UTC (rev 117112)
@@ -145,8 +145,6 @@
 		E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
 		E490296814E2E3A4002BEDD1 /* TypingStyleCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */; };
 		F3FC3EE313678B7300126A65 /* libgtest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F3FC3EE213678B7300126A65 /* libgtest.a */; };
-		F6A6BFBB1558AC4800926107 /* simple-unload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F6A6BFB91558ABF800926107 /* simple-unload.html */; };
-		F6A6BFBC1558AC4B00926107 /* simple-iframe-unload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F6A6BFB81558ABF800926107 /* simple-iframe-unload.html */; };
 		F6F3F29113342FEB00A6BF19 /* CookieManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */; };
 		F6F49C6915545C8E0007F39D /* DOMWindowExtensionNoCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */; };
 		F6F49C6B15545CA70007F39D /* DOMWindowExtensionNoCache_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */; };
@@ -197,9 +195,7 @@
 				F6FDDDD614241C6F004F1729 /* push-state.html in Copy Resources */,
 				BCBD3737125ABBEB00D2C29F /* icon.png in Copy Resources */,
 				1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */,
-				F6A6BFBC1558AC4B00926107 /* simple-iframe-unload.html in Copy Resources */,
 				BC909784125571CF00083756 /* simple.html in Copy Resources */,
-				F6A6BFBB1558AC4800926107 /* simple-unload.html in Copy Resources */,
 				C0ADBE9612FCA79B00D2C129 /* simple-form.html in Copy Resources */,
 				BCAA485614A0444C0088FAC4 /* simple-tall.html in Copy Resources */,
 				C01A23F21266156700C9ED55 /* spacebar-scrolling.html in Copy Resources */,
@@ -367,8 +363,6 @@
 		E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCacheDisableWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
 		E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TypingStyleCrash.mm; sourceTree = "<group>"; };
 		F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
-		F6A6BFB81558ABF800926107 /* simple-iframe-unload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-iframe-unload.html"; sourceTree = "<group>"; };
-		F6A6BFB91558ABF800926107 /* simple-unload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-unload.html"; sourceTree = "<group>"; };
 		F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CookieManager.cpp; sourceTree = "<group>"; };
 		F6F49C6615545C8D0007F39D /* DOMWindowExtensionNoCache_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionNoCache_Bundle.cpp; sourceTree = "<group>"; };
 		F6F49C6715545C8D0007F39D /* DOMWindowExtensionNoCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionNoCache.cpp; sourceTree = "<group>"; };
@@ -606,9 +600,7 @@
 				1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */,
 				C0ADBE8412FCA6B600D2C129 /* simple-form.html */,
 				33DC890E1419539300747EF7 /* simple-iframe.html */,
-				F6A6BFB81558ABF800926107 /* simple-iframe-unload.html */,
 				BCAA485514A021640088FAC4 /* simple-tall.html */,
-				F6A6BFB91558ABF800926107 /* simple-unload.html */,
 				BC909778125571AB00083756 /* simple.html */,
 				C02B7882126615410026BF0F /* spacebar-scrolling.html */,
 				76E182DE15475A8300F1FADD /* auto-submitting-form.html */,

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionNoCache.cpp (117111 => 117112)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionNoCache.cpp	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/DOMWindowExtensionNoCache.cpp	2012-05-15 19:05:52 UTC (rev 117112)
@@ -91,20 +91,20 @@
     injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
     WKContextSetInjectedBundleClient(context.get(), &injectedBundleClient);
 
-    // FIXME 85891: Instead of using unload handlers to prevent use of the page cache, set the
-    // cache model to kWKCacheModelDocumentView, which sets page cache capacity to 0.
+    // Disable the page cache.
+    WKContextSetCacheModel(context.get(), kWKCacheModelDocumentViewer);
 
     PlatformWebView webView(context.get(), pageGroup.get());
 
     // Make sure the extensions for each frame are installed in each world.
-    WKRetainPtr<WKURLRef> url1(AdoptWK, Util::createURLForResource("simple-iframe-unload", "html"));
+    WKRetainPtr<WKURLRef> url1(AdoptWK, Util::createURLForResource("simple-iframe", "html"));
     WKPageLoadURL(webView.page(), url1.get());
 
     Util::run(&finished);
     finished = false;
 
     // Make sure those first 4 extensions are destroyed, and 2 new ones are installed.
-    WKRetainPtr<WKURLRef> url2(AdoptWK, Util::createURLForResource("simple-unload", "html"));
+    WKRetainPtr<WKURLRef> url2(AdoptWK, Util::createURLForResource("simple", "html"));
     WKPageLoadURL(webView.page(), url2.get());
 
     Util::run(&finished);

Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit2/simple-iframe-unload.html (117111 => 117112)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/simple-iframe-unload.html	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/simple-iframe-unload.html	2012-05-15 19:05:52 UTC (rev 117112)
@@ -1,6 +0,0 @@
-<html>
-<body _onunload_="/* disable page cache */">
-  Simple HTML file with an unload handler.
-  <iframe src=""
-</body>
-</html>

Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit2/simple-unload.html (117111 => 117112)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/simple-unload.html	2012-05-15 19:03:54 UTC (rev 117111)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/simple-unload.html	2012-05-15 19:05:52 UTC (rev 117112)
@@ -1,5 +0,0 @@
-<html>
-<body _onunload_="/* disable page cache */">
-  Simple HTML file with an unload handler.
-</body>
-</html>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to