Bug 1180824 - Implement media playback events for browser-element / Graphene. r=fabrice

This commit is contained in:
Brian R. Bondy 2015-07-10 20:30:01 -04:00
parent e0404d2093
commit d78efaf293
2 changed files with 11 additions and 1 deletions

View File

@ -55,6 +55,7 @@ let CERTIFICATE_ERROR_PAGE_PREF = 'security.alternate_certificate_error_page';
const OBSERVED_EVENTS = [
'xpcom-shutdown',
'media-playback',
'activity-done'
];
@ -279,14 +280,22 @@ BrowserElementChild.prototype = {
observe: function(subject, topic, data) {
// Ignore notifications not about our document. (Note that |content| /can/
// be null; see bug 874900.)
if (topic !== 'activity-done' && (!content || subject != content.document))
if (topic !== 'activity-done' && topic !== 'media-playback' &&
(!content || subject !== content.document)) {
return;
}
if (topic == 'activity-done' && docShell !== subject)
return;
switch (topic) {
case 'activity-done':
sendAsyncMsg('activitydone', { success: (data == 'activity-success') });
break;
case 'media-playback':
if (subject === content) {
sendAsyncMsg('mediaplaybackchange', { _payload_: data });
}
break;
case 'xpcom-shutdown':
this._shuttingDown = true;
break;

View File

@ -215,6 +215,7 @@ BrowserElementParent.prototype = {
};
let mmSecuritySensitiveCalls = {
"mediaplaybackchange": this._fireEventFromMsg,
"showmodalprompt": this._handleShowModalPrompt,
"contextmenu": this._fireCtxMenuEvent,
"securitychange": this._fireEventFromMsg,