Title: [250425] trunk
Revision
250425
Author
[email protected]
Date
2019-09-27 08:56:04 -0700 (Fri, 27 Sep 2019)

Log Message

IDBRequest should not prevent a page from entering the back/forward cache
https://bugs.webkit.org/show_bug.cgi?id=202270
<rdar://problem/55744717>

Reviewed by Youenn Fablet.

Source/WebCore:

Update IDBRequest::canSuspendForDocumentSuspension() to return true instead of
false. IDBRequest can only fire 2 events (error / success) and for both its
merely enqueues the Event to the DocumentEventQueue. The DocumentEventQueue
uses a SuspendableTimer (which will be suspended while the document is in the
page cache) so there is no risk of firing the events (and thus running script)
while in the page cache.

Test: storage/indexeddb/IDBRequest-page-cache.html

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::canSuspendForDocumentSuspension const):

LayoutTests:

Add layout test coverage.

* storage/indexeddb/IDBRequest-page-cache-expected.txt: Added.
* storage/indexeddb/IDBRequest-page-cache.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (250424 => 250425)


--- trunk/LayoutTests/ChangeLog	2019-09-27 15:55:01 UTC (rev 250424)
+++ trunk/LayoutTests/ChangeLog	2019-09-27 15:56:04 UTC (rev 250425)
@@ -1,3 +1,16 @@
+2019-09-27  Chris Dumez  <[email protected]>
+
+        IDBRequest should not prevent a page from entering the back/forward cache
+        https://bugs.webkit.org/show_bug.cgi?id=202270
+        <rdar://problem/55744717>
+
+        Reviewed by Youenn Fablet.
+
+        Add layout test coverage.
+
+        * storage/indexeddb/IDBRequest-page-cache-expected.txt: Added.
+        * storage/indexeddb/IDBRequest-page-cache.html: Added.
+
 2019-09-27  Alex Christensen  <[email protected]>
 
         Remove unused WebProcessPool::setCanHandleHTTPSServerTrustEvaluation

Added: trunk/LayoutTests/storage/indexeddb/IDBRequest-page-cache-expected.txt (0 => 250425)


--- trunk/LayoutTests/storage/indexeddb/IDBRequest-page-cache-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/IDBRequest-page-cache-expected.txt	2019-09-27 15:56:04 UTC (rev 250425)
@@ -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/IDBRequest-page-cache.html (0 => 250425)


--- trunk/LayoutTests/storage/indexeddb/IDBRequest-page-cache.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/IDBRequest-page-cache.html	2019-09-27 15:56:04 UTC (rev 250425)
@@ -0,0 +1,34 @@
+<!-- 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");
+
+         window.location = "../../fast/history/resources/page-cache-helper.html";
+    }, 0);
+ };
+</script>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (250424 => 250425)


--- trunk/Source/WebCore/ChangeLog	2019-09-27 15:55:01 UTC (rev 250424)
+++ trunk/Source/WebCore/ChangeLog	2019-09-27 15:56:04 UTC (rev 250425)
@@ -1,3 +1,23 @@
+2019-09-27  Chris Dumez  <[email protected]>
+
+        IDBRequest should not prevent a page from entering the back/forward cache
+        https://bugs.webkit.org/show_bug.cgi?id=202270
+        <rdar://problem/55744717>
+
+        Reviewed by Youenn Fablet.
+
+        Update IDBRequest::canSuspendForDocumentSuspension() to return true instead of
+        false. IDBRequest can only fire 2 events (error / success) and for both its
+        merely enqueues the Event to the DocumentEventQueue. The DocumentEventQueue
+        uses a SuspendableTimer (which will be suspended while the document is in the
+        page cache) so there is no risk of firing the events (and thus running script)
+        while in the page cache.
+
+        Test: storage/indexeddb/IDBRequest-page-cache.html
+
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::canSuspendForDocumentSuspension const):
+
 2019-09-27  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Remove redundant Line::TextContext member variables

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (250424 => 250425)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2019-09-27 15:55:01 UTC (rev 250424)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2019-09-27 15:56:04 UTC (rev 250425)
@@ -262,7 +262,7 @@
 bool IDBRequest::canSuspendForDocumentSuspension() const
 {
     ASSERT(&originThread() == &Thread::current());
-    return false;
+    return true;
 }
 
 bool IDBRequest::hasPendingActivity() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to