<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181728] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181728">181728</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2015-03-18 22:21:40 -0700 (Wed, 18 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Test disk cache behavior when using back navigation cache policy
https://bugs.webkit.org/show_bug.cgi?id=142848
Reviewed by Chris Dumez.
Source/WebCore:
Add a way to override the normal cache policy so we can test reload behavior of cache without actually reloading.
Test: http/tests/cache/disk-cache-validation-back-navigation-policy.html
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::addExtraFieldsToRequest):
* loader/FrameLoader.h:
(WebCore::FrameLoader::setOverrideCachePolicyForTesting):
* testing/Internals.cpp:
(WebCore::Internals::setOverrideCachePolicy):
* testing/Internals.h:
* testing/Internals.idl:
LayoutTests:
* http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt: Added.
* http/tests/cache/disk-cache-validation-back-navigation-policy.html: Added.
Test permutations of cache headers on reload including Cache-control: must-revalidate.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestscachediskcachevalidationhtml">trunk/LayoutTests/http/tests/cache/disk-cache-validation.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoaderh">trunk/Source/WebCore/loader/FrameLoader.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestscachediskcachevalidationbacknavigationpolicyexpectedtxt">trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestscachediskcachevalidationbacknavigationpolicyhtml">trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/LayoutTests/ChangeLog        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-18 Antti Koivisto <antti@apple.com>
+
+ Test disk cache behavior when using back navigation cache policy
+ https://bugs.webkit.org/show_bug.cgi?id=142848
+
+ Reviewed by Chris Dumez.
+
+ * http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt: Added.
+ * http/tests/cache/disk-cache-validation-back-navigation-policy.html: Added.
+
+ Test permutations of cache headers on reload including Cache-control: must-revalidate.
+
+ * platform/mac-wk1/TestExpectations:
+ * platform/win/TestExpectations:
+
</ins><span class="cx"> 2015-03-18 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> ES6 Classes: Extends should accept an expression without parenthesis
</span></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcachevalidationbacknavigationpolicyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt (0 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt         (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy-expected.txt        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -0,0 +1,173 @@
</span><ins>+Test permutations of various cache headers when using back navigation cache policy
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+running 54 tests
+
+response headers: undefined
+response source: Disk cache
+
+response headers: {"Cache-control":"max-age=0"}
+response source: Disk cache
+
+response headers: {"Cache-control":"max-age=100"}
+response source: Disk cache
+
+response headers: {"Cache-control":"no-store"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-store"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-store"}
+response source: Network
+
+response headers: {"Cache-control":"no-cache"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-cache"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-cache"}
+response source: Network
+
+response headers: {"ETag":"match"}
+response source: Disk cache
+
+response headers: {"Cache-control":"max-age=0","ETag":"match"}
+response source: Disk cache
+
+response headers: {"Cache-control":"max-age=100","ETag":"match"}
+response source: Disk cache
+
+response headers: {"Cache-control":"no-store","ETag":"match"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-store","ETag":"match"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-store","ETag":"match"}
+response source: Network
+
+response headers: {"Cache-control":"no-cache","ETag":"match"}
+response source: Disk cache after validation
+
+response headers: {"Cache-control":"max-age=0, no-cache","ETag":"match"}
+response source: Disk cache after validation
+
+response headers: {"Cache-control":"max-age=100, no-cache","ETag":"match"}
+response source: Disk cache after validation
+
+response headers: {"ETag":"nomatch"}
+response source: Disk cache
+
+response headers: {"Cache-control":"max-age=0","ETag":"nomatch"}
+response source: Disk cache
+
+response headers: {"Cache-control":"max-age=100","ETag":"nomatch"}
+response source: Disk cache
+
+response headers: {"Cache-control":"no-store","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-store","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-store","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"no-cache","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-cache","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-cache","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, must-revalidate"}
+response source: Disk cache
+
+response headers: {"Cache-control":"no-store, must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-store, must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-store, must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"no-cache, must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-cache, must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-cache, must-revalidate"}
+response source: Network
+
+response headers: {"ETag":"match","Cache-control":"must-revalidate"}
+response source: Disk cache after validation
+
+response headers: {"Cache-control":"max-age=0, must-revalidate","ETag":"match"}
+response source: Disk cache after validation
+
+response headers: {"Cache-control":"max-age=100, must-revalidate","ETag":"match"}
+response source: Disk cache
+
+response headers: {"Cache-control":"no-store, must-revalidate","ETag":"match"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-store, must-revalidate","ETag":"match"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-store, must-revalidate","ETag":"match"}
+response source: Network
+
+response headers: {"Cache-control":"no-cache, must-revalidate","ETag":"match"}
+response source: Disk cache after validation
+
+response headers: {"Cache-control":"max-age=0, no-cache, must-revalidate","ETag":"match"}
+response source: Disk cache after validation
+
+response headers: {"Cache-control":"max-age=100, no-cache, must-revalidate","ETag":"match"}
+response source: Disk cache after validation
+
+response headers: {"ETag":"nomatch","Cache-control":"must-revalidate"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, must-revalidate","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, must-revalidate","ETag":"nomatch"}
+response source: Disk cache
+
+response headers: {"Cache-control":"no-store, must-revalidate","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-store, must-revalidate","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-store, must-revalidate","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"no-cache, must-revalidate","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=0, no-cache, must-revalidate","ETag":"nomatch"}
+response source: Network
+
+response headers: {"Cache-control":"max-age=100, no-cache, must-revalidate","ETag":"nomatch"}
+response source: Network
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcachevalidationbacknavigationpolicyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy.html (0 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy.html         (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache-validation-back-navigation-policy.html        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+<script src="/js-test-resources/js-test-pre.js"></script>
+<script src="resources/cache-test.js"></script>
+<body>
+<script>
+
+var testMatrix =
+[
+ [
+ {},
+ { responseHeaders: {'Cache-control': 'max-age=0' } },
+ { responseHeaders: {'Cache-control': 'max-age=100' } },
+ ],
+ [
+ {},
+ { responseHeaders: {'Cache-control': 'no-store' } },
+ { responseHeaders: {'Cache-control': 'no-cache' } },
+ ],
+ [
+ {},
+ { responseHeaders: {'ETag': 'match' } },
+ { responseHeaders: {'ETag': 'nomatch' } },
+ ],
+ [
+ {},
+ { responseHeaders: {'Cache-control': 'must-revalidate' } },
+ ],
+ ];
+
+description("Test permutations of various cache headers when using back navigation cache policy");
+
+// Simulate cache behavior on back navigation.
+internals.setOverrideCachePolicy("ReturnCacheDataElseLoad");
+
+var tests = generateTests(testMatrix);
+
+debug("running " + tests.length + " tests");
+debug("");
+
+runTests(tests);
+
+</script>
+<script src="/js-test-resources/js-test-post.js"></script>
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcachevalidationhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/cache/disk-cache-validation.html (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache-validation.html        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/LayoutTests/http/tests/cache/disk-cache-validation.html        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> debug("running " + tests.length + " tests");
</span><span class="cx"> debug("");
</span><span class="cx">
</span><del>-runTests(generateTests(testMatrix));
</del><ins>+runTests(tests);
</ins><span class="cx">
</span><span class="cx"> </script>
</span><span class="cx"> <script src="/js-test-resources/js-test-post.js"></script>
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx">
</span><span class="cx"> # Disk cache is WK2 only
</span><span class="cx"> http/tests/cache/disk-cache-validation.html
</span><ins>+http/tests/cache/disk-cache-validation-back-navigation-policy.html
</ins><span class="cx"> http/tests/cache/disk-cache-disable.html
</span><span class="cx"> http/tests/cache/disk-cache-vary-cookie.html
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/LayoutTests/platform/win/TestExpectations        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -2230,6 +2230,7 @@
</span><span class="cx">
</span><span class="cx"> # Disk cache is WK2 only
</span><span class="cx"> http/tests/cache/disk-cache-validation.html
</span><ins>+http/tests/cache/disk-cache-validation-back-navigation-policy.html
</ins><span class="cx"> http/tests/cache/disk-cache-disable.html
</span><span class="cx"> http/tests/cache/disk-cache-vary-cookie.html
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/Source/WebCore/ChangeLog        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-03-18 Antti Koivisto <antti@apple.com>
+
+ Test disk cache behavior when using back navigation cache policy
+ https://bugs.webkit.org/show_bug.cgi?id=142848
+
+ Reviewed by Chris Dumez.
+
+ Add a way to override the normal cache policy so we can test reload behavior of cache without actually reloading.
+
+ Test: http/tests/cache/disk-cache-validation-back-navigation-policy.html
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::addExtraFieldsToRequest):
+ * loader/FrameLoader.h:
+ (WebCore::FrameLoader::setOverrideCachePolicyForTesting):
+ * testing/Internals.cpp:
+ (WebCore::Internals::setOverrideCachePolicy):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
</ins><span class="cx"> 2015-03-18 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> TextFragment#start() is always >= 0 since its type is unsigned
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -2558,6 +2558,9 @@
</span><span class="cx"> } else if (loadType == FrameLoadType::Reload || loadType == FrameLoadType::ReloadFromOrigin || request.isConditional())
</span><span class="cx"> request.setCachePolicy(ReloadIgnoringCacheData);
</span><span class="cx">
</span><ins>+ if (m_overrideCachePolicyForTesting)
+ request.setCachePolicy(m_overrideCachePolicyForTesting.value());
+
</ins><span class="cx"> if (request.cachePolicy() == ReloadIgnoringCacheData) {
</span><span class="cx"> if (loadType == FrameLoadType::Reload)
</span><span class="cx"> request.setHTTPHeaderField(HTTPHeaderName::CacheControl, "max-age=0");
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.h (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.h        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/Source/WebCore/loader/FrameLoader.h        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -41,10 +41,12 @@
</span><span class="cx"> #include "PageThrottler.h"
</span><span class="cx"> #include "ResourceHandleTypes.h"
</span><span class="cx"> #include "ResourceLoadNotifier.h"
</span><ins>+#include "ResourceRequestBase.h"
</ins><span class="cx"> #include "SecurityContext.h"
</span><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><ins>+#include <wtf/Optional.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -287,6 +289,9 @@
</span><span class="cx">
</span><span class="cx"> void forcePageTransitionIfNeeded();
</span><span class="cx">
</span><ins>+ void setOverrideCachePolicyForTesting(ResourceRequestCachePolicy policy) { m_overrideCachePolicyForTesting = policy; }
+ void clearOverrideCachePolicyForTesting() { m_overrideCachePolicyForTesting = Nullopt; }
+
</ins><span class="cx"> private:
</span><span class="cx"> enum FormSubmissionCacheLoadPolicy {
</span><span class="cx"> MayAttemptCacheOnlyLoadForFormSubmissionItem,
</span><span class="lines">@@ -436,6 +441,8 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<FrameNetworkingContext> m_networkingContext;
</span><span class="cx">
</span><ins>+ Optional<ResourceRequestCachePolicy> m_overrideCachePolicyForTesting;
+
</ins><span class="cx"> URL m_previousURL;
</span><span class="cx"> RefPtr<HistoryItem> m_requestedHistoryItem;
</span><span class="cx"> PageActivityAssertionToken m_activityAssertion;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -308,6 +308,7 @@
</span><span class="cx"> page->mainFrame().editor().toggleContinuousSpellChecking();
</span><span class="cx"> if (page->mainFrame().editor().isOverwriteModeEnabled())
</span><span class="cx"> page->mainFrame().editor().toggleOverwriteModeEnabled();
</span><ins>+ page->mainFrame().loader().clearOverrideCachePolicyForTesting();
</ins><span class="cx"> ApplicationCacheStorage::singleton().setDefaultOriginQuota(ApplicationCacheStorage::noQuota());
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> MediaSessionManager::sharedManager().resetRestrictions();
</span><span class="lines">@@ -425,6 +426,25 @@
</span><span class="cx"> return "Error";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static ResourceRequestCachePolicy stringToResourceRequestCachePolicy(const String& policy)
+{
+ if (policy == "UseProtocolCachePolicy")
+ return UseProtocolCachePolicy;
+ if (policy == "ReloadIgnoringCacheData")
+ return ReloadIgnoringCacheData;
+ if (policy == "ReturnCacheDataElseLoad")
+ return ReturnCacheDataElseLoad;
+ if (policy == "ReturnCacheDataDontLoad")
+ return ReturnCacheDataDontLoad;
+ ASSERT_NOT_REACHED();
+ return UseProtocolCachePolicy;
+}
+
+void Internals::setOverrideCachePolicy(const String& policy)
+{
+ frame()->loader().setOverrideCachePolicyForTesting(stringToResourceRequestCachePolicy(policy));
+}
+
</ins><span class="cx"> void Internals::clearMemoryCache()
</span><span class="cx"> {
</span><span class="cx"> MemoryCache::singleton().evictResources();
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/Source/WebCore/testing/Internals.h        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -89,6 +89,7 @@
</span><span class="cx"> bool isPreloaded(const String& url);
</span><span class="cx"> bool isLoadingFromMemoryCache(const String& url);
</span><span class="cx"> String xhrResponseSource(XMLHttpRequest*);
</span><ins>+ void setOverrideCachePolicy(const String&);
</ins><span class="cx">
</span><span class="cx"> void clearMemoryCache();
</span><span class="cx"> void pruneMemoryCacheToSize(unsigned size);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (181727 => 181728)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2015-03-19 05:16:41 UTC (rev 181727)
+++ trunk/Source/WebCore/testing/Internals.idl        2015-03-19 05:21:40 UTC (rev 181728)
</span><span class="lines">@@ -29,6 +29,15 @@
</span><span class="cx"> "document"
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+// These map to ResourceRequestCachePolicy.
+enum CachePolicy {
+ "UseProtocolCachePolicy",
+ "ReloadIgnoringCacheData",
+ "ReturnCacheDataElseLoad",
+ "ReturnCacheDataDontLoad"
+};
+
+
</ins><span class="cx"> [
</span><span class="cx"> NoInterfaceObject,
</span><span class="cx"> ] interface Internals {
</span><span class="lines">@@ -46,6 +55,7 @@
</span><span class="cx"> void clearMemoryCache();
</span><span class="cx"> void pruneMemoryCacheToSize(long size);
</span><span class="cx"> long memoryCacheSize();
</span><ins>+ void setOverrideCachePolicy(CachePolicy policy);
</ins><span class="cx">
</span><span class="cx"> void clearPageCache();
</span><span class="cx"> unsigned int pageCacheSize();
</span></span></pre>
</div>
</div>
</body>
</html>