I might take a stab at it. In the PWA code, this simplifies a bunch of stuff, and I imagine MANY systems do this:
- Listen for navigation to complete (page to be changed)
- "calculate stuff and save it", "possibly call observers", "call into other areas of code"
- Listen for navigation to start / complete again to clear state and start again
This is incompatible inherently with things like bfcache (and we re-calculate stuff as a result) and cannot easily take advantage of prerendering if it wants to.
For storage, things like a PageUserData allow for storage in an inherently bf-cache compatible way. You COULD store than, and then in the 'navigation complete' check the existing page to see what the state it, and use cached state if it's there.
But wouldn't it be nice to just not have to deal with WebContents at all? Just have a PageUserData that can also listen for lifecycle events on the page itself?
I'll start poking at this if I have time.