commit f9c320c2b6e0202358438cdc0610789fd6254229
parent ae1ded48f37c362692e673bf28b78d1f0a9848ee
Author: alwu <alwu@mozilla.com>
Date: Thu, 30 Oct 2025 21:06:22 +0000
Bug 1997122 - set the callback function properly for RemoteSettings. r=media-playback-reviewers,karlt
Differential Revision: https://phabricator.services.mozilla.com/D270587
Diffstat:
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/toolkit/components/media/WindowsMediaFoundationCDMOriginsListService.sys.mjs b/toolkit/components/media/WindowsMediaFoundationCDMOriginsListService.sys.mjs
@@ -81,12 +81,8 @@ WindowsMediaFoundationCDMOriginsListService.prototype = {
}
this._rs = lazy.RemoteSettings(COLLECTION_NAME);
- this._rs.on("sync", async event => {
- let {
- data: { current },
- } = event;
- this._onUpdateEntries(current || []);
- });
+ this._rsListener = this._onRemoteSettingSync.bind(this);
+ this._rs.on("sync", this._rsListener);
let entries;
try {
@@ -99,6 +95,13 @@ WindowsMediaFoundationCDMOriginsListService.prototype = {
this._entriesReady = true;
},
+ _onRemoteSettingSync(event) {
+ let {
+ data: { current },
+ } = event;
+ this._onUpdateEntries(current || []);
+ },
+
_onUpdateEntries(aEntries) {
log(`Update entries, aEntries=${JSON.stringify(aEntries, null, 2)}`);
const entries = Cc["@mozilla.org/array;1"].createInstance(
@@ -133,8 +136,9 @@ WindowsMediaFoundationCDMOriginsListService.prototype = {
this._callbacks = null;
this._originsList = null;
if (this._rs) {
- this._rs.off("sync");
+ this._rs.off("sync", this._rsListener);
this._rs = null;
+ this._rsListener = null;
}
}
},