browser.sessions APIs (restore and getRecentlyClosed) break when a documentPictureInPicture window is active
Categories
(Firefox :: Session Restore, defect, P2)
Tracking
()
People
(Reporter: i, Unassigned)
References
Details
Attachments
(1 file)
|
1.52 KB,
application/x-zip-compressed
|
Details |
Steps to reproduce:
- Load the attached minimal reproducible extension.
- Open
about:debugging#/runtime/this-firefox. - Click Load Temporary Add-on....
- Select
extension/manifest.json
- Open a standard browser window with a few tabs, then close some of the tabs so there is a recently closed session available.
- Click the extension icon to open the extension popup.
- Click "Get Recently Closed" or "Restore Last Session".
- Both button should work correctly.
- Open a
documentPictureInPicturewindow.
- Open https://mdn.github.io/dom-examples/document-picture-in-picture/
- Click Toggle Picture-in-Picture.
- Click the extension icon to open the extension popup.
- Click "Get Recently Closed" or "Restore Last Session".
- Error: An unexpected error occurred
Actual results:
The sessions API should function normally regardless of whether a documentPictureInPicture window is open.
getRecentlyClosed() should return the list of recently closed tabs/windows.
restore(null) should restore the most recently closed tab/window.
Expected results:
The API calls fail when the documentPictureInPicture window is active.
Error: An unexpected error occurred
Sorry, I mixed up "Actual results" and "Expected results." It seems I'm not able to edit the bug details.
Comment 2•2 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Session Restore' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•2 months ago
|
||
Bug 1858562 introduced Document PiP and I recommended that document PiP windows should not be tracked by session restore at all.
It looks like there are some flows through the sessions API that depend on the active window having a session store ID, but document PiP windows do not have one.
We'll need to audit the sessions API calls that go to session restore and figure out whether it's acceptable to fulfill the calls from another window with a session restore ID. If not, document PiP windows may need to be tracked by session restore and we may need to introduce lots of special logic to skip specific unwanted session restore activity for those windows.
This is still reproducible in Firefox Nightly 157.0a1 (2026-09-07).
https://i.imgur.com/64qYfTq.png
Description
•