Open Bug 2059966 Opened 2 months ago Updated 1 month ago

browser.sessions APIs (restore and getRecentlyClosed) break when a documentPictureInPicture window is active

Categories

(Firefox :: Session Restore, defect, P2)

Firefox 153
defect

Tracking

()

UNCONFIRMED

People

(Reporter: i, Unassigned)

References

Details

Attachments

(1 file)

1.52 KB, application/x-zip-compressed
Details
Attached file repro-extension.zip —

Steps to reproduce:

  1. Load the attached minimal reproducible extension.
  • Open about:debugging#/runtime/this-firefox.
  • Click Load Temporary Add-on....
  • Select extension/manifest.json
  1. Open a standard browser window with a few tabs, then close some of the tabs so there is a recently closed session available.
  2. Click the extension icon to open the extension popup.
  • Click "Get Recently Closed" or "Restore Last Session".
  • Both button should work correctly.
  1. Open a documentPictureInPicture window.
  1. 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.

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.

Component: Untriaged → Session Restore

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.

Severity: -- → S3
Priority: -- → P2
See Also: → 1858562

This is still reproducible in Firefox Nightly 157.0a1 (2026-09-07).
https://i.imgur.com/64qYfTq.png

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: