- Revision
- 250531
- Author
- cdu...@apple.com
- Date
- 2019-09-30 15:33:32 -0700 (Mon, 30 Sep 2019)
Log Message
IDBTransaction / IDBObjectStore should not prevent a page from entering the back / forward cache
https://bugs.webkit.org/show_bug.cgi?id=202291
<rdar://problem/55760106>
Reviewed by Geoffrey Garen.
Source/WebCore:
IDBObjectStore does not fire any events and should therefore not cause any problem while in PageCache.
IDBTransaction can only fire abort/complete/error events, all of which are being enqueued to the
DocumentEventQueue. The DocumentEventQueue subclasses SuspendableTimer which will correctly suspend
while the document is in page cache. IDBTransaction will therefore not cause events to fire (and JS
to run) while in page cache.
Test: storage/indexeddb/IDBTransaction-page-cache.html
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::canSuspendForDocumentSuspension const):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
LayoutTests:
Add layout test coverage.
* storage/indexeddb/IDBTransaction-page-cache.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (250530 => 250531)
--- trunk/LayoutTests/ChangeLog 2019-09-30 21:09:04 UTC (rev 250530)
+++ trunk/LayoutTests/ChangeLog 2019-09-30 22:33:32 UTC (rev 250531)
@@ -1,5 +1,17 @@
2019-09-30 Chris Dumez <cdu...@apple.com>
+ IDBTransaction / IDBObjectStore should not prevent a page from entering the back / forward cache
+ https://bugs.webkit.org/show_bug.cgi?id=202291
+ <rdar://problem/55760106>
+
+ Reviewed by Geoffrey Garen.
+
+ Add layout test coverage.
+
+ * storage/indexeddb/IDBTransaction-page-cache.html: Added.
+
+2019-09-30 Chris Dumez <cdu...@apple.com>
+
Pages with Web Workers cannot enter the back / forward cache
https://bugs.webkit.org/show_bug.cgi?id=202296
<rdar://problem/55764073>
Modified: trunk/LayoutTests/fast/history/page-cache-indexed-opened-db-expected.txt (250530 => 250531)
--- trunk/LayoutTests/fast/history/page-cache-indexed-opened-db-expected.txt 2019-09-30 21:09:04 UTC (rev 250530)
+++ trunk/LayoutTests/fast/history/page-cache-indexed-opened-db-expected.txt 2019-09-30 22:33:32 UTC (rev 250531)
@@ -1,10 +1,12 @@
-Tests that a page with an open IndexedDB database does not go into the page cache.
+Tests that a page with an open IndexedDB database goes into the page cache.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
pageshow - not from cache
-PASS Page was not restored from page cache
+pagehide - entering cache
+pageshow - from cache
+PASS Page did enter and was restored from the page cache
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/history/page-cache-indexed-opened-db.html (250530 => 250531)
--- trunk/LayoutTests/fast/history/page-cache-indexed-opened-db.html 2019-09-30 21:09:04 UTC (rev 250530)
+++ trunk/LayoutTests/fast/history/page-cache-indexed-opened-db.html 2019-09-30 22:33:32 UTC (rev 250531)
@@ -4,7 +4,7 @@
<body>
<script src=""
<script>
-description('Tests that a page with an open IndexedDB database does not go into the page cache.');
+description('Tests that a page with an open IndexedDB database goes into the page cache.');
window.jsTestIsAsync = true;
window.addEventListener("pageshow", function(event) {
@@ -15,16 +15,16 @@
delete window.sessionStorage.page_cache_open_indexeddb_test_started;
if (event.persisted)
- testFailed("Page did enter and was restored from the page cache");
+ testPassed("Page did enter and was restored from the page cache");
else
- testPassed("Page was not restored from page cache");
+ testFailed("Page was not restored from page cache");
finishJSTest();
}, false);
window.addEventListener("pagehide", function(event) {
debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
- if (event.persisted) {
- testFailed("Page entered the page cache.");
+ if (!event.persisted) {
+ testFailed("Page failed to enter the page cache.");
finishJSTest();
}
}, false);
Added: trunk/LayoutTests/storage/indexeddb/IDBTransaction-page-cache-expected.txt (0 => 250531)
--- trunk/LayoutTests/storage/indexeddb/IDBTransaction-page-cache-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/IDBTransaction-page-cache-expected.txt 2019-09-30 22:33:32 UTC (rev 250531)
@@ -0,0 +1,13 @@
+Tests that an IDBRequest does not prevent page caching.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+pageshow - not from page cache
+pagehide - entering page cache
+pageshow - from page cache
+PASS Page entered page cache
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/IDBTransaction-page-cache.html (0 => 250531)
--- trunk/LayoutTests/storage/indexeddb/IDBTransaction-page-cache.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/IDBTransaction-page-cache.html 2019-09-30 22:33:32 UTC (rev 250531)
@@ -0,0 +1,43 @@
+<!-- webkit-test-runner [ enablePageCache=true ] -->
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that an IDBRequest does not prevent page caching.");
+jsTestIsAsync = true;
+
+window.addEventListener("pageshow", function(event) {
+ debug("pageshow - " + (event.persisted ? "" : "not ") + "from page cache");
+ if (event.persisted) {
+ testPassed("Page entered page cache");
+ finishJSTest();
+ }
+ });
+
+ window.addEventListener("pagehide", function(event) {
+ debug("pagehide - " + (event.persisted ? "" : "not ") + "entering page cache");
+ if (!event.persisted) {
+ testFailed("Page failed to enter page cache");
+ finishJSTest();
+ }
+ });
+
+ _onload_ = () => {
+ setTimeout(() => {
+ request = indexedDB.open("MyTestDatabase");
+ request._onerror_ = function(event) {
+ testFailed("Failed to open the database");
+ finishJSTest();
+ }
+ request._onupgradeneeded_ = function(event) {
+ var db = event.target.result;
+ objectStore = db.createObjectStore("customers", { keyPath: "ssn" });
+ transaction = objectStore.transaction;
+
+ window.location = "../../fast/history/resources/page-cache-helper.html";
+ };
+ }, 0);
+ };
+</script>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (250530 => 250531)
--- trunk/Source/WebCore/ChangeLog 2019-09-30 21:09:04 UTC (rev 250530)
+++ trunk/Source/WebCore/ChangeLog 2019-09-30 22:33:32 UTC (rev 250531)
@@ -1,5 +1,26 @@
2019-09-30 Chris Dumez <cdu...@apple.com>
+ IDBTransaction / IDBObjectStore should not prevent a page from entering the back / forward cache
+ https://bugs.webkit.org/show_bug.cgi?id=202291
+ <rdar://problem/55760106>
+
+ Reviewed by Geoffrey Garen.
+
+ IDBObjectStore does not fire any events and should therefore not cause any problem while in PageCache.
+ IDBTransaction can only fire abort/complete/error events, all of which are being enqueued to the
+ DocumentEventQueue. The DocumentEventQueue subclasses SuspendableTimer which will correctly suspend
+ while the document is in page cache. IDBTransaction will therefore not cause events to fire (and JS
+ to run) while in page cache.
+
+ Test: storage/indexeddb/IDBTransaction-page-cache.html
+
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::canSuspendForDocumentSuspension const):
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
+
+2019-09-30 Chris Dumez <cdu...@apple.com>
+
Refine restrictions for X-Temp-Tablet HTTP header experiment
https://bugs.webkit.org/show_bug.cgi?id=202367
<rdar://problem/55849139>
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (250530 => 250531)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2019-09-30 21:09:04 UTC (rev 250530)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2019-09-30 22:33:32 UTC (rev 250531)
@@ -77,7 +77,7 @@
bool IDBObjectStore::canSuspendForDocumentSuspension() const
{
- return false;
+ return true;
}
bool IDBObjectStore::hasPendingActivity() const
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (250530 => 250531)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2019-09-30 21:09:04 UTC (rev 250530)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2019-09-30 22:33:32 UTC (rev 250531)
@@ -326,7 +326,7 @@
bool IDBTransaction::canSuspendForDocumentSuspension() const
{
ASSERT(&m_database->originThread() == &Thread::current());
- return false;
+ return true;
}
bool IDBTransaction::hasPendingActivity() const