зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1628117 - Remove fennec code from marionette. r=snorp,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D70455 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
aff542f7f1
Коммит
17c29b71da
|
@ -72,6 +72,21 @@ Context.Chrome = "chrome";
|
|||
Context.Content = "content";
|
||||
this.Context = Context;
|
||||
|
||||
// GeckoView shim for Desktop's gBrowser
|
||||
class MobileTabBrowser {
|
||||
constructor(window) {
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
get tabs() {
|
||||
return [this.window.tab];
|
||||
}
|
||||
|
||||
get selectedTab() {
|
||||
return this.window.tab;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code><xul:browser></code> for the specified tab.
|
||||
*
|
||||
|
@ -82,12 +97,7 @@ this.Context = Context;
|
|||
* The linked browser for the tab or null if no browser can be found.
|
||||
*/
|
||||
browser.getBrowserForTab = function(tab) {
|
||||
// Fennec
|
||||
if (tab && "browser" in tab) {
|
||||
return tab.browser;
|
||||
|
||||
// Firefox
|
||||
} else if (tab && "linkedBrowser" in tab) {
|
||||
if (tab && "linkedBrowser" in tab) {
|
||||
return tab.linkedBrowser;
|
||||
}
|
||||
|
||||
|
@ -104,11 +114,9 @@ browser.getBrowserForTab = function(tab) {
|
|||
* Tab browser or null if it's not a browser window.
|
||||
*/
|
||||
browser.getTabBrowser = function(window) {
|
||||
// Fennec
|
||||
if ("BrowserApp" in window) {
|
||||
return window.BrowserApp;
|
||||
|
||||
// Firefox
|
||||
if ("browser" in window) {
|
||||
// GeckoView
|
||||
return new MobileTabBrowser(window);
|
||||
} else if ("gBrowser" in window) {
|
||||
return window.gBrowser;
|
||||
|
||||
|
@ -124,7 +132,7 @@ browser.getTabBrowser = function(window) {
|
|||
* Creates a browsing context wrapper.
|
||||
*
|
||||
* Browsing contexts handle interactions with the browser, according to
|
||||
* the current environment (Firefox, Fennec).
|
||||
* the current environment.
|
||||
*/
|
||||
browser.Context = class {
|
||||
/**
|
||||
|
@ -138,7 +146,7 @@ browser.Context = class {
|
|||
this.driver = driver;
|
||||
|
||||
// In Firefox this is <xul:tabbrowser> (not <xul:browser>!)
|
||||
// and BrowserApp in Fennec
|
||||
// and MobileTabBrowser in GeckoView.
|
||||
this.tabBrowser = browser.getTabBrowser(this.window);
|
||||
|
||||
this.knownFrames = [];
|
||||
|
@ -396,12 +404,6 @@ browser.Context = class {
|
|||
let tabClosed;
|
||||
|
||||
switch (this.driver.appName) {
|
||||
case "fennec":
|
||||
// Fennec
|
||||
tabClosed = waitForEvent(this.tabBrowser.deck, "TabClose");
|
||||
this.tabBrowser.closeTab(this.tab);
|
||||
break;
|
||||
|
||||
case "firefox":
|
||||
tabClosed = waitForEvent(this.tab, "TabClose");
|
||||
this.tabBrowser.removeTab(this.tab);
|
||||
|
@ -424,11 +426,6 @@ browser.Context = class {
|
|||
let tabOpened = waitForEvent(this.window, "TabOpen");
|
||||
|
||||
switch (this.driver.appName) {
|
||||
case "fennec":
|
||||
tab = this.tabBrowser.addTab(null);
|
||||
this.tabBrowser.selectTab(focus ? tab : this.tab);
|
||||
break;
|
||||
|
||||
case "firefox":
|
||||
this.window.BrowserOpenTab();
|
||||
tab = this.tabBrowser.selectedTab;
|
||||
|
@ -489,11 +486,6 @@ browser.Context = class {
|
|||
let tabSelected = waitForEvent(this.window, "TabSelect");
|
||||
|
||||
switch (this.driver.appName) {
|
||||
case "fennec":
|
||||
this.tabBrowser.selectTab(this.tab);
|
||||
await tabSelected;
|
||||
break;
|
||||
|
||||
case "firefox":
|
||||
this.tabBrowser.selectedTab = this.tab;
|
||||
await tabSelected;
|
||||
|
|
Загрузка…
Ссылка в новой задаче