Bug 1111967 - honor browser.casting.enabled pref for casting on desktop, r=mconley
This commit is contained in:
@@ -218,14 +218,15 @@ nsContextMenu.prototype = {
|
||||
this.showItem("context-sendaudio", this.onAudio);
|
||||
this.setItemAttr("context-sendvideo", "disabled", !this.mediaURL);
|
||||
this.setItemAttr("context-sendaudio", "disabled", !this.mediaURL);
|
||||
let shouldShowCast = Services.prefs.getBoolPref("browser.casting.enabled");
|
||||
// getServicesForVideo alone would be sufficient here (it depends on
|
||||
// SimpleServiceDiscovery.services), but SimpleServiceDiscovery is garanteed
|
||||
// to be already loaded, since we load it on startup, and CastingApps isn't,
|
||||
// so check SimpleServiceDiscovery.services first to avoid needing to load
|
||||
// CastingApps.jsm if we don't need to.
|
||||
let shouldShowCast = this.mediaURL &&
|
||||
SimpleServiceDiscovery.services.length > 0 &&
|
||||
CastingApps.getServicesForVideo(this.target).length > 0;
|
||||
// SimpleServiceDiscovery.services), but SimpleServiceDiscovery is guaranteed
|
||||
// to be already loaded, since we load it on startup in nsBrowserGlue,
|
||||
// and CastingApps isn't, so check SimpleServiceDiscovery.services first
|
||||
// to avoid needing to load CastingApps.jsm if we don't need to.
|
||||
shouldShowCast = shouldShowCast && this.mediaURL &&
|
||||
SimpleServiceDiscovery.services.length > 0 &&
|
||||
CastingApps.getServicesForVideo(this.target).length > 0;
|
||||
this.setItemAttr("context-castvideo", "disabled", !shouldShowCast);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user