Create a JSON schema to describe the graph that is serialized for session restore
Categories
(Firefox :: Session Restore, task, P3)
Tracking
()
People
(Reporter: sfoster, Assigned: sfoster)
References
Details
In bug 1849393 we identified a need for a formal schema that defines what goes into a session file. These are an in-memory javascript graph that gets serialized to JSON and compressed and written to disk as a .jsonlz4 file, allowing a user to seamlessly resume a session after a restart or crash.
The basic structure looks something like this:
{
"version": [
"sessionrestore",
1
],
"windows": [
{
"tabs": [
{
"entries": [
{
"url": "https://example.com/",
"title": "Page title",
"hasUserInteraction": false,
"triggeringPrincipal_base64": "{\"3\":{}}"
},
....
],
"lastAccessed": 1697149705740,
"hidden": false,
"searchMode": null,
"userContextId": 0,
"attributes": {},
"index": 3,
"requestedIndex": 0,
"image": "data:image/x-icon;base64,etc.."
},
...
],
"_closedTabs": [
{
"state": {
"entries": [
{
"url": "https://elsewhere.com/",
"title": "Page title",
"resultPrincipalURI": null,
"principalToInherit_base64": "{\"0\":{\"0\":\"moz-nullprincipal:{b8140753-f226-4c5d-9749-fc3eea899d9f}\"}}",
"hasUserInteraction": true,
"triggeringPrincipal_base64": "{\"3\":{}}",
"persist": true
}
],
"lastAccessed": 1697142677640,
"hidden": false,
"searchMode": null,
"userContextId": 0,
"attributes": {},
"index": 1,
"requestedIndex": 0,
"image": "..."
},
"title": "Page title",
"image": "...",
"pos": 0,
"closedAt": 1697147353955,
"closedInGroup": false,
"removeAfterRestore": true,
"closedId": 3,
"sourceWindowId": "window0"
},
...
]
},
...
},
"selectedWindow": 0,
"_closedWindows": [
...
],
"session": {
"lastUpdate": 1697149716870,
"startTime": 1697149627011,
"recentCrashes": 1
},
"global": {},
"cookies": [
{
"host": "example.com",
"value": "af6e3...",
"path": "/",
"name": "someName",
"secure": true,
"httponly": true,
"expiry": 1697142669447,
"originAttributes": {
"firstPartyDomain": "",
"geckoViewSessionContextId": "",
"inIsolatedMozBrowser": false,
"partitionKey": "",
"privateBrowsingId": 0,
"userContextId": 3
},
"sameSite": 1,
"schemeMap": 2
},
...
]
}
...but there is quite a lot of detail down at the individual entries level for each tab.
Having a schema would be useful in tests and also a known quantity and jumping off point for any future optimization or re-architecting of how session (res)store works.
Assignee | ||
Comment 1•16 days ago
•
|
||
I have a work-in-progress for the JSON schema at https://github.com/sfoster/moz-sessionrestore-tools, the draft schema itself its at session-schema.json. Once that is closer to done and we have figured out where in the tree this should live, I'll get a patch on here. PRs welcome in the meantime.
Assignee | ||
Updated•9 days ago
|
Description
•