Bug 1625615 - part1 : update 'suspendMediaWhenInactive' when GeckoView setting changes r=snorp

Differential Revision: https://phabricator.services.mozilla.com/D69884
This commit is contained in:
alwu 2020-04-22 02:08:27 +00:00
Родитель f6f59cedd1
Коммит d09fa27d37
2 изменённых файлов: 13 добавлений и 4 удалений

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

@ -128,11 +128,9 @@ class GeckoViewContent extends GeckoViewModule {
} else { } else {
this.browser.docShellIsActive = false; this.browser.docShellIsActive = false;
} }
var msgData = { this.messageManager.sendAsyncMessage("GeckoView:SetActive", {
active: aData.active, active: aData.active,
suspendMedia: this.settings.suspendMediaWhenInactive, });
};
this.messageManager.sendAsyncMessage("GeckoView:SetActive", msgData);
break; break;
case "GeckoView:SetFocused": case "GeckoView:SetFocused":
if (aData.focused) { if (aData.focused) {

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

@ -73,6 +73,7 @@ class GeckoViewSettings extends GeckoViewModule {
this.userAgentMode = settings.userAgentMode; this.userAgentMode = settings.userAgentMode;
this.userAgentOverride = settings.userAgentOverride; this.userAgentOverride = settings.userAgentOverride;
this.sessionContextId = settings.sessionContextId; this.sessionContextId = settings.sessionContextId;
this.suspendMediaWhenInactive = settings.suspendMediaWhenInactive;
} }
get userAgent() { get userAgent() {
@ -107,6 +108,16 @@ class GeckoViewSettings extends GeckoViewModule {
this._userAgentOverride = aUserAgent; this._userAgentOverride = aUserAgent;
} }
get suspendMediaWhenInactive() {
return this.browser.suspendMediaWhenInactive;
}
set suspendMediaWhenInactive(aSuspendMediaWhenInactive) {
if (aSuspendMediaWhenInactive != this.browser.suspendMediaWhenInactive) {
this.browser.suspendMediaWhenInactive = aSuspendMediaWhenInactive;
}
}
get displayMode() { get displayMode() {
return this.window.docShell.displayMode; return this.window.docShell.displayMode;
} }