Bug 1597793 - Use setTabActive in GVE. r=snorp

Differential Revision: https://phabricator.services.mozilla.com/D60943

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Agi Sferro 2020-01-25 07:27:19 +00:00
Родитель c1ad4b4c0f
Коммит d8a9316c60
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -494,6 +494,7 @@ public class GeckoViewActivity
session.open(sGeckoRuntime);
mTabSessionManager.setCurrentSession(session);
mGeckoView.setSession(session);
sGeckoRuntime.getWebExtensionController().setTabActive(session, true);
}
loadFromIntent(getIntent());
}
@ -649,6 +650,7 @@ public class GeckoViewActivity
session.open(sGeckoRuntime);
mTabSessionManager.setCurrentSession(session);
mGeckoView.setSession(session);
sGeckoRuntime.getWebExtensionController().setTabActive(session, true);
if (mCurrentUri != null) {
session.loadUri(mCurrentUri);
}
@ -658,7 +660,8 @@ public class GeckoViewActivity
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
if(savedInstanceState != null) {
mTabSessionManager.setCurrentSession((TabSession)mGeckoView.getSession());
mTabSessionManager.setCurrentSession((TabSession) mGeckoView.getSession());
sGeckoRuntime.getWebExtensionController().setTabActive(mGeckoView.getSession(), true);
} else {
recreateSession();
}
@ -838,11 +841,16 @@ public class GeckoViewActivity
}
private void setGeckoViewSession(TabSession session) {
mGeckoView.releaseSession();
if(!session.isOpen()) {
final WebExtensionController controller = sGeckoRuntime.getWebExtensionController();
final GeckoSession previousSession = mGeckoView.releaseSession();
if (previousSession != null) {
controller.setTabActive(previousSession, false);
}
if (!session.isOpen()) {
session.open(sGeckoRuntime);
}
mGeckoView.setSession(session);
controller.setTabActive(session, true);
mTabSessionManager.setCurrentSession(session);
}