Closed Bug 1877191 Opened 8 months ago Closed 8 months ago

Add skipPermitUnload parameter to ContextualIdentityService.closeContainerTabs

Categories

(Core :: DOM: Security, task, P3)

task
Points:
2

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox124 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 1 open bug)

Details

(Whiteboard: [webdriver:m10][domsecurity-backlog])

Attachments

(1 file)

We should expose an option to skip before unload prompts in ContextualIdentityService.closeContainerTabs and forward it to tabbrowser.removeTab

Component: WebDriver BiDi → DOM: Security
Product: Remote Protocol → Core

If this bug is moved to our component, could you explain a bit more what you want to happen?

Severity: -- → N/A
Priority: -- → P3
Whiteboard: [domsecurity-backlog]
Flags: needinfo?(jdescottes)

Sure. In the WebDriver BiDi spec, when removing a user context we should close all related browsing contexts and skip any potential before unload prompt.

To close the tabs we use closeContainerTabs, which relies on tabbrowser.removeTab. removeTab supports a skipPermitUnload option, so the idea would be to add a skipPermitUnload parameter to closeContainerTabs and forward it to removeTab. So something like:

  closeContainerTabs(userContextId = 0, skipPermitUnload=false) {
    return new Promise(resolve => {
      let remoteTabIds = new Set();
      this._forEachContainerTab((tab, tabbrowser) => {
        let frameLoader = tab.linkedBrowser.frameLoader;

        // We don't have remoteTab in non-e10s mode.
        if (frameLoader.remoteTab) {
          remoteTabIds.add(frameLoader.remoteTab.tabId);
        }

        tabbrowser.removeTab(tab, { skipPermitUnload });
      }, userContextId);

      if (remoteTabIds.size == 0) {
        resolve();
        return;
      }

      new _TabRemovalObserver(resolve, remoteTabIds);
    });
  },
Flags: needinfo?(jdescottes)

Adds a removeTabOptions optional parameter to closeContainerTabs that will be forwarded to tabbrowser.removeTab
This allows to set options such as skipPermitUnload.
Browser mochitest added to check the new behavior. This should be a noop for current consumers of the API.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1c4672e11b77 Add removeTabOptions parameter to ContextualIdentityService.closeContainerTabs r=mconley
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Points: --- → 2
Whiteboard: [domsecurity-backlog] → [webdriver:m10][domsecurity-backlog]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: