Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Clear-Site-Data: "cache"
HTTP header should clear the back/forward …
…cache https://bugs.webkit.org/show_bug.cgi?id=245553 Reviewed by Brent Fulgham. `Clear-Site-Data: "cache"` was clearing the HTTP disk cache and the memory cache entries for the HTTP response origin. In addition to this, it now clear the back/forward cache entries for this origin too. * LayoutTests/http/tests/clear-site-data/bfcache-expected.txt: Added. * LayoutTests/http/tests/clear-site-data/bfcache.html: Added. * LayoutTests/http/tests/clear-site-data/resources/clear-site-data-and-navigate-back.html: Added. * LayoutTests/http/tests/clear-site-data/resources/clear-site-data-cache.py: Added. Add test coverage. * Source/WebCore/history/BackForwardCache.cpp: (WebCore::BackForwardCache::clearEntriesForOrigins): * Source/WebCore/history/BackForwardCache.h: * Source/WebKit/WebProcess/WebProcess.cpp: (WebKit::WebProcess::deleteWebsiteDataForOrigins): Clear the back/forward cache too when we're asked to clear the memory cache. This matches the behavior of WebProcess::deleteWebsiteData() where clearing the memory cache implies clearing the back/forward cache too. Canonical link: https://commits.webkit.org/254798@main
- Loading branch information
Showing
9 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Tests that the Clear-Site-Data can be used to clear the back/forward cache. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
pageshow - not from cache | ||
PASS wasRestoredFromPageCache is false | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!-- webkit-test-runner [ UsesBackForwardCache=true ] --> | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<script src="/js-test-resources/js-test.js"></script> | ||
<script> | ||
description("Tests that the Clear-Site-Data can be used to clear the back/forward cache."); | ||
jsTestIsAsync = true; | ||
|
||
addEventListener("pageshow", function(event) { | ||
debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache"); | ||
|
||
if (!window.sessionStorage.page_cache_clear_site_data_test_started) | ||
return; | ||
|
||
wasRestoredFromPageCache = event.persisted; | ||
shouldBeFalse("wasRestoredFromPageCache"); | ||
finishJSTest(); | ||
}); | ||
|
||
onload = () => { | ||
if (sessionStorage.page_cache_clear_site_data_test_started) | ||
return; | ||
setTimeout(() => { | ||
sessionStorage.page_cache_clear_site_data_test_started = true; | ||
location.href = "resources/clear-site-data-and-navigate-back.html"; | ||
}, 0); | ||
}; | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<script> | ||
window.addEventListener("load", function() { | ||
fetch("clear-site-data-cache.py").then((r) => { | ||
history.back(); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
|
||
sys.stdout.write( | ||
'Clear-Site-Data: "cache"\r\n' | ||
'Content-Type: text/html\r\n\r\n' | ||
) | ||
|
||
print('FOO') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters