Open Bug 1875524 Opened 11 months ago Updated 10 months ago

Add a "WindowManager.supportsWindows()" helper to more easily check for multiple windows support

Categories

(Remote Protocol :: Agent, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned, Mentored)

Details

(Whiteboard: [lang=js])

Filed based on the discussion in the following Phabricator revision:
https://phabricator.services.mozilla.com/D199066#inline-1104049

To ease the checks for Marionette and WebDriver BiDi if on a given platform new windows are supported we should have a supportsWindows() method in the WindowManager module, which would be similar to TabManager.supportsTabs().

With that helper command added we could simplify the checks in Marionette (WebDriver:NewWindow command) and WebDriver BiDi (browsingContext.create command) to have something like:

let type;
if (typeHint == "tab" && supportsTabs() || typeHint == "window" && supportsWindows()) {
  type = typeHint;
} else if (lazy.TabManager.supportsTabs()) {
  type = "tab";
} else if (lazy.WindowManager.supportsWindows()) {
  type = "window";
} else {
  // throw appropriate error
}
Mentor: hskupin
Priority: -- → P3
Whiteboard: [lang=js]
You need to log in before you can comment on or make changes to this bug.