forked from mirrors/gecko-dev
This patch updates every use of EventManager in child/ext-*.js files that can referenced from extension contexts of envType "addon_child". Pre patch, these could trigger "background-script-reset-idle" and result in triggering "background-script-reset-idle" in the parent despite the background being stopped, and consequently trigger the reported bug. The previous patch fixes the negative consequence of this unexpected event, this patch fixes an underlying cause by removing the triggers. Forcing resetIdleOnEvent to false does not have any negative impact on these modules, because all of these events are dependencies of an EventManager in the parent, which already activates the functionality associated with resetIdleOnEvent=true. To minimize the likelihood of affecting unit tests, this patch keeps the EventManager of test.onMessage at resetIdleOnEvent=true as before, and defers to bug 1901294 for changing it to false. Original Revision: https://phabricator.services.mozilla.com/D215298 Differential Revision: https://phabricator.services.mozilla.com/D216987
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
/* vim: set sts=2 sw=2 et tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
this.omnibox = class extends ExtensionAPI {
|
|
getAPI(context) {
|
|
return {
|
|
omnibox: {
|
|
onInputChanged: new EventManager({
|
|
context,
|
|
name: "omnibox.onInputChanged",
|
|
// Parent event already resets idle if needed, no need to do it here.
|
|
resetIdleOnEvent: false,
|
|
register: fire => {
|
|
let listener = (text, id) => {
|
|
fire.asyncWithoutClone(text, suggestions => {
|
|
context.childManager.callParentFunctionNoReturn(
|
|
"omnibox.addSuggestions",
|
|
[id, suggestions]
|
|
);
|
|
});
|
|
};
|
|
context.childManager
|
|
.getParentEvent("omnibox.onInputChanged")
|
|
.addListener(listener);
|
|
return () => {
|
|
context.childManager
|
|
.getParentEvent("omnibox.onInputChanged")
|
|
.removeListener(listener);
|
|
};
|
|
},
|
|
}).api(),
|
|
},
|
|
};
|
|
}
|
|
};
|