forked from mirrors/gecko-dev
Bug 1851373 - Only forcefully set EventManager resetIdleOnEvent flag to false for extensions with a persistent background page. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D187494
This commit is contained in:
parent
6ffde8feae
commit
f8539031f7
3 changed files with 11 additions and 5 deletions
|
|
@ -2277,8 +2277,18 @@ class EventManager {
|
|||
this.context.envType === "addon_parent" &&
|
||||
this.context.isBackgroundContext;
|
||||
|
||||
// TODO(Bug 1844041): ideally we should restrict resetIdleOnEvent to
|
||||
// EventManager instances that belongs to the event page, but along
|
||||
// with that we should consider if calling sendMessage from an event
|
||||
// page should also reset idle timer, and so in the shorter term
|
||||
// here we are allowing listeners from other extension pages to
|
||||
// also reset the idle timer.
|
||||
const isAddonContext = ["addon_parent", "addon_child"].includes(
|
||||
this.context.envType
|
||||
);
|
||||
|
||||
// Avoid resetIdleOnEvent overhead by only consider it when applicable.
|
||||
if (!isBackgroundParent || context.extension.persistentBackground) {
|
||||
if (!isAddonContext || context.extension.persistentBackground) {
|
||||
this.resetIdleOnEvent = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,8 +101,6 @@ let fooExperimentFiles = {
|
|||
|
||||
assertResetOnIdleOnEvent() {
|
||||
const expectResetIdleOnEventFalse =
|
||||
this.context.envType !== "addon_parent" ||
|
||||
!this.context.isBackgroundContext ||
|
||||
this.context.extension.persistentBackground;
|
||||
if (expectResetIdleOnEventFalse && this.resetIdleOnEvent) {
|
||||
const details = {
|
||||
|
|
|
|||
|
|
@ -92,8 +92,6 @@ const API = class extends ExtensionAPI {
|
|||
|
||||
assertResetOnIdleOnEvent() {
|
||||
const expectResetIdleOnEventFalse =
|
||||
this.context.envType !== "addon_parent" ||
|
||||
!this.context.isBackgroundContext ||
|
||||
this.context.extension.persistentBackground;
|
||||
if (expectResetIdleOnEventFalse && this.resetIdleOnEvent) {
|
||||
const details = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue