-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "Use the same SessionStorageNamespace for prerendering"
This is a reland of eefb8c561ab863863b0541125df363fef040eabb The original CL was reverted because the PrerenderBackForwardCacheBrowserTest was flaky. The test didn’t check the behavior of BackForwardCache. It was just running the same tests of PrerenderBrowserTest.SessionStorageAfterBackNavigation_NoProcessReuse or SessionStorageAfterBackNavigation_KeepInitialProcess. If the initial process have been killed before the back navigation, the test failed. To make the BackForwardCache logic work this CL changed the browser test as followings: - Added enable_same_site flag. - Stopped using BroadcastChannel which prevent BFCache. PS1 is the same as the original CL. Original change's description: > Use the same SessionStorageNamespace for prerendering > > Currently there is an issue that the Session Storage is not carried over > to the prerendering page. This is because a new Session Storage > Namespace is used for the prerendering page. > > To fix this issue, this CL changes PrerenderHost::PageHolder to copy the > Session Storage Namespace from the initiator page to the prerendering > page. > > We don’t want the Session Storage state in the storage service be > updated by the prerendering page. And we want to synchronize the Session > Storage state of the prerendering page with the initiator page when the > prerendering page is activated. So this CL introduces a flag > |is_session_storage_for_prerendering_| in CachedStorageArea, and make > CachedStorageArea not to send the changes of the Session Storage state > to the storage service, and make StorageArea recreate |cached_area_| > when the prerendering page is activated. > > This is the "clone & swap" mechanism for session storage in prerendering > described in whatwg/storage#119. > > This CL still has an issue that when the initial renderer process is > reused after the back navigation from a prerendered page, the Session > Storage state is not correctly propagated to the initial renderer > process. This issue will be fixed in the next CL. > https://crrev.com/c/2849654 > > Bug: 1197383 > Change-Id: Ib43386ccf75f8c867bcddb4b77b333ee0d5b5d79 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2850242 > Reviewed-by: Kinuko Yasuda <[email protected]> > Reviewed-by: Matt Falkenhagen <[email protected]> > Reviewed-by: Marijn Kruisselbrink <[email protected]> > Commit-Queue: Tsuyoshi Horo <[email protected]> > Cr-Commit-Position: refs/heads/master@{#881985} Bug: 1197383 Change-Id: If83c11d44e37b598111ab1c5ce4a78dfd3757176 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2891279 Reviewed-by: Hiroki Nakagawa <[email protected]> Reviewed-by: Kinuko Yasuda <[email protected]> Reviewed-by: Fergal Daly <[email protected]> Reviewed-by: Matt Falkenhagen <[email protected]> Commit-Queue: Tsuyoshi Horo <[email protected]> Cr-Commit-Position: refs/heads/master@{#883819} NOKEYCHECK=True GitOrigin-RevId: c226ef4e5aaa66edbf29db3239e91bd49bcac2d2
- Loading branch information
1 parent
4c0b44d
commit bbedc5b
Showing
16 changed files
with
375 additions
and
17 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
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
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
20 changes: 20 additions & 0 deletions
20
..._tests/wpt_internal/prerender/resources/session-storage-carry-over-to-prerender-page.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,20 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="utils.js"></script> | ||
<script src="session-storage-utils.js"></script> | ||
<script> | ||
RunSessionStorageTest(async (isPrerendering, url, prerenderChannel, done) => { | ||
if (!isPrerendering) { | ||
sessionStorage.setItem('set by initiator page', '1'); | ||
startPrerendering(url); | ||
} else { | ||
assert_equals( | ||
getSessionStorageKeys(), | ||
'set by initiator page', | ||
'The session storage item set by the initiator page must be carried' + | ||
' over to the prerendering page.'); | ||
done(); | ||
} | ||
}); | ||
</script> |
41 changes: 41 additions & 0 deletions
41
...b_tests/wpt_internal/prerender/resources/session-storage-isolated-while-prerendering.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,41 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="utils.js"></script> | ||
<script src="session-storage-utils.js"></script> | ||
<script> | ||
RunSessionStorageTest(async (isPrerendering, url, prerenderChannel, done) => { | ||
if (!isPrerendering) { | ||
startPrerendering(url); | ||
// Wait for the message from the prerendering page. | ||
assert_equals( | ||
await getNextMessage(prerenderChannel), | ||
'From prerendering page 1') | ||
|
||
// Add an item to the session storage. | ||
sessionStorage.setItem('set by initiator page', '1'); | ||
|
||
// Send the message to the prerendering page. | ||
prerenderChannel.postMessage('From initiator page'); | ||
|
||
} else { | ||
sessionStorage.setItem('set by prerendering page', '1'); | ||
|
||
// Send the message to the initiator page. | ||
prerenderChannel.postMessage('From prerendering page 1'); | ||
|
||
// Wait for the message from the initiator page. | ||
assert_equals( | ||
await getNextMessage(prerenderChannel), | ||
'From initiator page'); | ||
|
||
assert_equals( | ||
getSessionStorageKeys(), | ||
'set by prerendering page', | ||
'The session storage item added by the initiator page after the ' + | ||
'prerendering page accessed the session storage must not be visible ' + | ||
'in the prerendering page.'); | ||
done(); | ||
} | ||
}); | ||
</script> |
35 changes: 35 additions & 0 deletions
35
...web_tests/wpt_internal/prerender/resources/session-storage-no-leak-to-initiator-page.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,35 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="utils.js"></script> | ||
<script src="session-storage-utils.js"></script> | ||
<script> | ||
RunSessionStorageTest(async (isPrerendering, url, prerenderChannel, done) => { | ||
if (!isPrerendering) { | ||
startPrerendering(url); | ||
|
||
// Wait for the message from the prerendering page. | ||
assert_equals( | ||
await getNextMessage(prerenderChannel), | ||
'From prerendering page') | ||
|
||
assert_equals( | ||
getSessionStorageKeys(), | ||
'', | ||
'The session storage item set by the prerendering page must not be ' + | ||
'visible in the initiator page.'); | ||
|
||
done(); | ||
} else { | ||
sessionStorage.setItem('set by prerendering page', '1'); | ||
|
||
assert_equals( | ||
getSessionStorageKeys(), | ||
'set by prerendering page', | ||
'The session storage item must have been added by the prerendering' + | ||
' page.'); | ||
// Send the message to the initiator page. | ||
prerenderChannel.postMessage('From prerendering page'); | ||
} | ||
}); | ||
</script> |
Oops, something went wrong.