WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
the patch.2
bug-130728-20140325155600.patch (text/plain), 15.77 KB, created by
Blaze Burg
on 2014-03-25 15:56:22 PDT
(
hide
)
Description:
the patch.2
Filename:
MIME Type:
Creator:
Blaze Burg
Created:
2014-03-25 15:56:22 PDT
Size:
15.77 KB
patch
obsolete
>Subversion Revision: 166260 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3f0d8c22e9ae920f9081b5b66c0f34f0ab707dd2..120acd5e7a2ef4d019538fd31b5325c199cb43e7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,41 @@ >+2014-03-25 Brian Burg <bburg@apple.com> >+ >+ Web Replay: add page-level setting to bypass the MemoryCache >+ https://bugs.webkit.org/show_bug.cgi?id=130728 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When replaying a specific Page we don't want to store its cached resources in the >+ MemoryCache. This patch adds a page setting to prevent the page's resources from >+ being saved in the MemoryCache. >+ >+ If Settings::usesMemoryCache() is false, page resources are given the special >+ SessionID bypassCacheSessionID(). The cached resource loader and memory cache >+ act as if the memory cache is disabled if the resource has this special session id. >+ >+ Test: http/tests/cache/bypass-memory-cache-after-reload.html >+ >+ * loader/cache/CachedResourceLoader.cpp: >+ (WebCore::CachedResourceLoader::requestResource): >+ (WebCore::CachedResourceLoader::revalidateResource): >+ * loader/cache/MemoryCache.cpp: >+ (WebCore::MemoryCache::add): >+ * page/Page.cpp: >+ (WebCore::Page::sessionID): >+ * page/SessionID.h: >+ (WebCore::SessionID::bypassCacheSessionID): >+ * page/Settings.cpp: >+ (WebCore::Settings::Settings): >+ * page/Settings.h: >+ (WebCore::Settings::setUsesMemoryCache): >+ (WebCore::Settings::usesMemoryCache): >+ * testing/InternalSettings.cpp: >+ (WebCore::InternalSettings::Backup::Backup): >+ (WebCore::InternalSettings::Backup::restoreTo): >+ (WebCore::InternalSettings::setUsesMemoryCache): >+ * testing/InternalSettings.h: >+ * testing/InternalSettings.idl: >+ > 2014-03-25 Radu Stavila <stavila@adobe.com> > > [CSS Regions] The background of children of scrollable elements flowed into regions is not properly scrolled >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index fabec1a7f26fca7741364270afdefda36c8ea2be..45d5bb66f4b9e03ab7b6ca2d4de0708d06a68974 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,13 @@ >+2014-03-25 Brian Burg <bburg@apple.com> >+ >+ Web Replay: add page-level setting to bypass the MemoryCache >+ https://bugs.webkit.org/show_bug.cgi?id=130728 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/APISession.cpp: >+ (API::generateID): update the base ID for generating unique sessions. >+ > 2014-03-25 Jeffrey Pfau <jpfau@apple.com> > > [WK2] Schemes registered as cache partitioned are not properly registered in new web processes >diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >index 601f711de1209bc996a052cfbcda6bd10c2f5093..0d75dc36bc2c8ded118da93e70d9f226fc57b6aa 100644 >--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp >+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp >@@ -484,7 +484,10 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache > m_validatedURLs.add(request.resourceRequest().url()); > > ASSERT(resource->url() == url.string()); >- m_documentResources.set(resource->url(), resource); >+ >+ if (sessionID() != SessionID::bypassCacheSessionID()) >+ m_documentResources.set(resource->url(), resource); >+ > return resource; > } > >@@ -496,6 +499,7 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(co > ASSERT(resource->canUseCacheValidator()); > ASSERT(!resource->resourceToRevalidate()); > ASSERT(resource->sessionID() == sessionID()); >+ ASSERT(sessionID() != SessionID::bypassCacheSessionID()); > > // Copy the URL out of the resource to be revalidated in case it gets deleted by the remove() call below. > String url = resource->url(); >diff --git a/Source/WebCore/loader/cache/MemoryCache.cpp b/Source/WebCore/loader/cache/MemoryCache.cpp >index a9a055364d531ef2f048e4e2f2c9bccf32d853a4..378038f3749a916d2734ad4f69874fef114efabd 100644 >--- a/Source/WebCore/loader/cache/MemoryCache.cpp >+++ b/Source/WebCore/loader/cache/MemoryCache.cpp >@@ -110,6 +110,9 @@ bool MemoryCache::add(CachedResource* resource) > if (disabled()) > return false; > >+ if (resource->sessionID() == SessionID::bypassCacheSessionID()) >+ return false; >+ > ASSERT(WTF::isMainThread()); > > CachedResourceMap& resources = getSessionMap(resource->sessionID()); >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index b3b15898e58591db31fffd6d01970dabce6e0f3d..70aef68c7c79bcc97c8b82254da78131b7b0498a 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -1516,6 +1516,9 @@ SessionID Page::sessionID() const > if (settings().privateBrowsingEnabled()) > return SessionID::legacyPrivateSessionID(); > >+ if (!settings().usesMemoryCache()) >+ return SessionID::bypassCacheSessionID(); >+ > return SessionID::defaultSessionID(); > } > >diff --git a/Source/WebCore/page/SessionID.h b/Source/WebCore/page/SessionID.h >index 5efd74aed9701cb5535c807b65435fc288c88a3d..c4deb1b30aecef0cbf15aedf7260175334dd7c6f 100644 >--- a/Source/WebCore/page/SessionID.h >+++ b/Source/WebCore/page/SessionID.h >@@ -43,6 +43,7 @@ public: > static SessionID emptySessionID() { return SessionID(0); } > static SessionID defaultSessionID() { return SessionID(1); } > static SessionID legacyPrivateSessionID() { return SessionID(2); } >+ static SessionID bypassCacheSessionID() { return SessionID(3); } > private: > uint64_t m_sessionID; > }; >diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp >index 32b5a7f9cca983387a2606c14a6e4eecddf48334..e7f60e4978dbbad52d1b4447473e56d8567d76be 100644 >--- a/Source/WebCore/page/Settings.cpp >+++ b/Source/WebCore/page/Settings.cpp >@@ -177,6 +177,7 @@ Settings::Settings(Page* page) > , m_isScriptEnabled(false) > , m_needsAdobeFrameReloadingQuirk(false) > , m_usesPageCache(false) >+ , m_usesMemoryCache(true) > , m_fontRenderingMode(0) > , m_showTiledScrollingIndicator(false) > , m_tiledBackingStoreEnabled(false) >diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h >index 516f0dce705ce8422c0803c9a4f938a3eb7e3360..458fa344f616478223d02978b4e58408c3b028b0 100644 >--- a/Source/WebCore/page/Settings.h >+++ b/Source/WebCore/page/Settings.h >@@ -181,7 +181,10 @@ public: > > void setUsesPageCache(bool); > bool usesPageCache() const { return m_usesPageCache; } >- >+ >+ void setUsesMemoryCache(bool usesMemoryCache) { m_usesMemoryCache = usesMemoryCache; } >+ bool usesMemoryCache() const { return m_usesMemoryCache; } >+ > void setFontRenderingMode(FontRenderingMode mode); > FontRenderingMode fontRenderingMode() const; > >@@ -307,6 +310,7 @@ private: > bool m_isScriptEnabled : 1; > bool m_needsAdobeFrameReloadingQuirk : 1; > bool m_usesPageCache : 1; >+ bool m_usesMemoryCache : 1; > unsigned m_fontRenderingMode : 1; > bool m_showTiledScrollingIndicator : 1; > bool m_tiledBackingStoreEnabled : 1; >diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp >index 31bd30c3c9d34ee57789a6a14f542f81fa8f86d3..50ef5a51d1b77c087da7a1895bf9291ec6613434 100644 >--- a/Source/WebCore/testing/InternalSettings.cpp >+++ b/Source/WebCore/testing/InternalSettings.cpp >@@ -91,6 +91,7 @@ InternalSettings::Backup::Backup(Settings& settings) > , m_autoscrollForDragAndDropEnabled(settings.autoscrollForDragAndDropEnabled()) > , m_pluginReplacementEnabled(RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled()) > , m_shouldConvertPositionStyleOnCopy(settings.shouldConvertPositionStyleOnCopy()) >+ , m_usesMemoryCache(settings.usesMemoryCache()) > { > } > >@@ -149,6 +150,7 @@ void InternalSettings::Backup::restoreTo(Settings& settings) > settings.setUseLegacyBackgroundSizeShorthandBehavior(m_useLegacyBackgroundSizeShorthandBehavior); > settings.setAutoscrollForDragAndDropEnabled(m_autoscrollForDragAndDropEnabled); > settings.setShouldConvertPositionStyleOnCopy(m_shouldConvertPositionStyleOnCopy); >+ settings.setUsesMemoryCache(m_usesMemoryCache); > RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(m_pluginReplacementEnabled); > } > >@@ -493,4 +495,10 @@ void InternalSettings::setShouldConvertPositionStyleOnCopy(bool convert, Excepti > settings()->setShouldConvertPositionStyleOnCopy(convert); > } > >+void InternalSettings::setUsesMemoryCache(bool usesMemoryCache, ExceptionCode& ec) >+{ >+ InternalSettingsGuardForSettings(); >+ settings()->setUsesMemoryCache(usesMemoryCache); >+} >+ > } >diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h >index 73073838575113d791141658a96cb186887ab4da..ed895584df773563b75e7e3fe02fa7246b84c9e1 100644 >--- a/Source/WebCore/testing/InternalSettings.h >+++ b/Source/WebCore/testing/InternalSettings.h >@@ -88,6 +88,7 @@ public: > bool m_autoscrollForDragAndDropEnabled; > bool m_pluginReplacementEnabled; > bool m_shouldConvertPositionStyleOnCopy; >+ bool m_usesMemoryCache; > }; > > static PassRefPtr<InternalSettings> create(Page* page) >@@ -132,7 +133,7 @@ public: > void setPluginReplacementEnabled(bool); > void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&); > void setShouldConvertPositionStyleOnCopy(bool convert, ExceptionCode&); >- >+ void setUsesMemoryCache(bool usesMemoryCache, ExceptionCode&); > > private: > explicit InternalSettings(Page*); >diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl >index 1dd6fa7eb28feff74bfea159563ca7f9dc3c63b9..0f6b5e245d5e0eae279b813b0e5a925419e3d479 100644 >--- a/Source/WebCore/testing/InternalSettings.idl >+++ b/Source/WebCore/testing/InternalSettings.idl >@@ -59,4 +59,5 @@ > void setPluginReplacementEnabled(boolean enabled); > [RaisesException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground); > [RaisesException] void setShouldConvertPositionStyleOnCopy(boolean convert); >+ [RaisesException] void setUsesMemoryCache(boolean usesMemoryCache); > }; >diff --git a/Source/WebKit2/UIProcess/APISession.cpp b/Source/WebKit2/UIProcess/APISession.cpp >index 55861b467bed8211f3956d955f03bb9b9220a024..d7a92515e7ca4ec1df118ab4bddeb5fd9583cd14 100644 >--- a/Source/WebKit2/UIProcess/APISession.cpp >+++ b/Source/WebKit2/UIProcess/APISession.cpp >@@ -34,7 +34,7 @@ static uint64_t generateID(bool isEphemeral) > { > ASSERT(RunLoop::isMain()); > >- static uint64_t uniqueSessionID = WebCore::SessionID::legacyPrivateSessionID().sessionID(); >+ static uint64_t uniqueSessionID = WebCore::SessionID::bypassCacheSessionID().sessionID(); > ASSERT_UNUSED(isEphemeral, isEphemeral); > return ++uniqueSessionID; > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index f8e5e2039de1825a0e90ab16ed4897a37d9952e7..5fa4f8c8fd4faaece9ea9662d79e222ecee7a5b4 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2014-03-25 Brian Burg <bburg@apple.com> >+ >+ Web Replay: add page-level setting to bypass the MemoryCache >+ https://bugs.webkit.org/show_bug.cgi?id=130728 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/cache/bypass-memory-cache-after-reload-expected.txt: Added. >+ * http/tests/cache/bypass-memory-cache-after-reload.html: Added. >+ > 2014-03-25 Radu Stavila <stavila@adobe.com> > > [CSS Regions] The background of children of scrollable elements flowed into regions is not properly scrolled >diff --git a/LayoutTests/http/tests/cache/bypass-memory-cache-after-reload-expected.txt b/LayoutTests/http/tests/cache/bypass-memory-cache-after-reload-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..ff9fa492a8d3f3b8ed162647dde569ef654a0397 >--- /dev/null >+++ b/LayoutTests/http/tests/cache/bypass-memory-cache-after-reload-expected.txt >@@ -0,0 +1,14 @@ >+http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html - didFinishLoading >+http://127.0.0.1:8000/favicon.ico - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/favicon.ico, main document URL http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html, http method GET> redirectResponse (null) >+http://127.0.0.1:8000/cache/resources/random-cached.cgi - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/random-cached.cgi, main document URL http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html, http method GET> redirectResponse (null) >+http://127.0.0.1:8000/favicon.ico - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/favicon.ico, http status code 200> >+http://127.0.0.1:8000/favicon.ico - didFinishLoading >+http://127.0.0.1:8000/cache/resources/random-cached.cgi - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/random-cached.cgi, http status code 200> >+http://127.0.0.1:8000/cache/resources/random-cached.cgi - didFinishLoading >+http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html, main document URL http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html, http method GET> redirectResponse (null) >+http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html, http status code 200> >+http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html - didFinishLoading >+http://127.0.0.1:8000/cache/resources/random-cached.cgi - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/cache/resources/random-cached.cgi, main document URL http://127.0.0.1:8000/cache/bypass-memory-cache-after-reload.html, http method GET> redirectResponse (null) >+http://127.0.0.1:8000/cache/resources/random-cached.cgi - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/cache/resources/random-cached.cgi, http status code 200> >+http://127.0.0.1:8000/cache/resources/random-cached.cgi - didFinishLoading >+FINISHED LOADING >diff --git a/LayoutTests/http/tests/cache/bypass-memory-cache-after-reload.html b/LayoutTests/http/tests/cache/bypass-memory-cache-after-reload.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b9a42ce275284d86995caeb009b6f7d4e8f8e193 >--- /dev/null >+++ b/LayoutTests/http/tests/cache/bypass-memory-cache-after-reload.html >@@ -0,0 +1,53 @@ >+<body> >+<h1></h1> >+<script> >+// Test that a subresource fetched after onload, following a reload, is >+// not cached if we configure the page's settings to bypass the memory cache. >+if (!sessionStorage.lastRandom) { >+ if (window.testRunner && window.internals) { >+ internals.settings.setUsesMemoryCache(false); >+ testRunner.dumpResourceLoadCallbacks(); >+ testRunner.dumpAsText(); >+ testRunner.waitUntilDone(); >+ } >+} >+ >+function done(result) >+{ >+ delete sessionStorage.lastRandom; >+ >+ document.body.innerText = result; >+ >+ if (window.testRunner) >+ testRunner.notifyDone(); >+} >+ >+function scriptLoaded() >+{ >+ setTimeout(function() >+ { >+ if (!window.randomNumber) >+ done('FAIL: window.randomNumber not defined!'); >+ else if (sessionStorage.lastRandom) { >+ // We don't want to compare the actual random numbers because >+ // the request may or may not be cached by the network stack. >+ done('FINISHED LOADING'); >+ } else { >+ sessionStorage.lastRandom = randomNumber; >+ location.reload(); >+ } >+ }, 0); >+} >+ >+onload = function() >+{ >+ setTimeout(function() >+ { >+ var s = document.createElement("script"); >+ s.src = "resources/random-cached.cgi"; >+ s.onload = scriptLoaded; >+ document.body.appendChild(s); >+ }, 0); >+}; >+</script> >+</body>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 130728
:
227785
|
227795
|
227797
|
227812
|
227817
|
227828
|
227830
|
228004
|
228218
|
228695
|
229241