зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1843507 - [bidi] Add support for "background" argument to "browsingContext.create" command. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D184453
This commit is contained in:
Родитель
60268388ae
Коммит
0717ff9cbf
|
@ -29,6 +29,9 @@ export class MobileTabBrowser {
|
|||
throw new Error("GeckoView only supports a single tab");
|
||||
}
|
||||
|
||||
// At the moment we don't have an API in `GeckoViewTabUtil` to select the tab,
|
||||
// something might be added in the scope of bug 1845559.
|
||||
|
||||
// Synthesize a custom TabSelect event to indicate that a tab has been
|
||||
// selected even when we don't change it.
|
||||
const event = this.window.CustomEvent("TabSelect", {
|
||||
|
|
|
@ -218,9 +218,13 @@ class WindowManager {
|
|||
|
||||
await Promise.all([activated, focused, startup]);
|
||||
|
||||
// The new window shouldn't get focused. As such set the
|
||||
// focus back to the opening window.
|
||||
if (!focus) {
|
||||
if (focus) {
|
||||
// Focus the currently selected tab.
|
||||
const browser = lazy.TabManager.getTabBrowser(win).selectedBrowser;
|
||||
browser.focus();
|
||||
} else {
|
||||
// If the new window shouldn't get focused, set the
|
||||
// focus back to the opening window.
|
||||
await this.focusWindow(openerWindow);
|
||||
}
|
||||
|
||||
|
|
|
@ -302,6 +302,9 @@ class BrowsingContextModule extends Module {
|
|||
* Create a new browsing context using the provided type "tab" or "window".
|
||||
*
|
||||
* @param {object=} options
|
||||
* @param {boolean=} options.background
|
||||
* Whether the tab/window should be open in the background. Defaults to false,
|
||||
* which means that the tab/window will be open in the foreground.
|
||||
* @param {string=} options.referenceContext
|
||||
* Id of the top-level browsing context to use as reference.
|
||||
* If options.type is "tab", the new tab will open in the same window as
|
||||
|
@ -316,17 +319,28 @@ class BrowsingContextModule extends Module {
|
|||
* If the browsing context cannot be found.
|
||||
*/
|
||||
async create(options = {}) {
|
||||
const { referenceContext: referenceContextId = null, type } = options;
|
||||
const {
|
||||
background = false,
|
||||
referenceContext: referenceContextId = null,
|
||||
type,
|
||||
} = options;
|
||||
if (type !== CreateType.tab && type !== CreateType.window) {
|
||||
throw new lazy.error.InvalidArgumentError(
|
||||
`Expected "type" to be one of ${Object.values(CreateType)}, got ${type}`
|
||||
);
|
||||
}
|
||||
|
||||
lazy.assert.boolean(
|
||||
background,
|
||||
lazy.pprint`Expected "background" to be a boolean, got ${background}`
|
||||
);
|
||||
|
||||
let browser;
|
||||
switch (type) {
|
||||
case "window":
|
||||
let newWindow = await lazy.windowManager.openBrowserWindow();
|
||||
const newWindow = await lazy.windowManager.openBrowserWindow({
|
||||
focus: !background,
|
||||
});
|
||||
browser = lazy.TabManager.getTabBrowser(newWindow).selectedBrowser;
|
||||
break;
|
||||
|
||||
|
@ -364,7 +378,7 @@ class BrowsingContextModule extends Module {
|
|||
}
|
||||
|
||||
const tab = await lazy.TabManager.addTab({
|
||||
focus: false,
|
||||
focus: !background,
|
||||
referenceTab,
|
||||
});
|
||||
browser = lazy.TabManager.getBrowserForTab(tab);
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
[background.py]
|
||||
[test_background_default_false[tab\]]
|
||||
expected:
|
||||
if os == "android": PASS
|
||||
FAIL
|
||||
|
||||
[test_background_default_false[window\]]
|
||||
expected:
|
||||
if os == "android": FAIL
|
||||
|
||||
[test_background[True-tab\]]
|
||||
expected:
|
||||
if os == "android": FAIL
|
||||
|
||||
[test_background[True-window\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_background[False-tab\]]
|
||||
expected:
|
||||
if os == "android": PASS
|
||||
FAIL
|
||||
disabled:
|
||||
if os == "android": Not supported
|
||||
|
||||
[test_background[False-window\]]
|
||||
disabled:
|
||||
if os == "android": Not supported
|
||||
|
||||
[test_background[True-window\]]
|
||||
disabled:
|
||||
if os == "android": Not supported
|
||||
|
||||
[test_background[True-tab\]]
|
||||
bug: 1845559
|
||||
expected:
|
||||
if os == "android": FAIL
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
[invalid.py]
|
||||
[test_params_background_invalid_type[None\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_params_background_invalid_type[\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_params_background_invalid_type[42\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_params_background_invalid_type[value3\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_params_background_invalid_type[value4\]]
|
||||
expected: FAIL
|
Загрузка…
Ссылка в новой задаче