Bug 1476701 - notify observer when audible autoplay occurred. r=cpearce,jaws
In our autoplay shield-study, we want to collect the information which could tell us how many website
contains audible autoplay media, but there is no way to get this information on current API desigin.
Therefore, I would like to send a new notification when autoplay occurred.
The extension code could get the information by following way,
```
Services.obs.addObserver((subject, topic, data) => {
// DO SOMETHING
}, "AudibleAutoplayMediaOccurred");
```
MozReview-Commit-ID: 4bSYcxDZOGK
This commit is contained in:
@@ -4431,6 +4431,16 @@ window._gBrowser = {
|
||||
tab.finishMediaBlockTimer();
|
||||
}
|
||||
});
|
||||
|
||||
this.addEventListener("AudibleAutoplayMediaOccurred", (event) => {
|
||||
let browser = event.originalTarget;
|
||||
let tab = this.getTabForBrowser(browser);
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
|
||||
Services.obs.notifyObservers(tab, "AudibleAutoplayMediaOccurred");
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user