mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1628871 - Don't show DRM install message if eme pref is locked. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D70763 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7eee44a592
commit
dece0b0c31
@ -89,3 +89,55 @@ add_task(async function() {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_eme_locked() {
|
||||
await BrowserTestUtils.withNewTab(TEST_URL, async function(browser) {
|
||||
// Reset prefs manually since we need to unlock them.
|
||||
let emeWasEnabled = Services.prefs.getBoolPref("media.eme.enabled", false);
|
||||
|
||||
// Restore the preferences to their pre-test state on test finish.
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.setBoolPref("media.eme.enabled", emeWasEnabled);
|
||||
Services.prefs.unlockPref("media.eme.enabled");
|
||||
});
|
||||
|
||||
// Turn off EME and Widevine CDM.
|
||||
Services.prefs.setBoolPref("media.eme.enabled", false);
|
||||
Services.prefs.lockPref("media.eme.enabled");
|
||||
|
||||
// Have content request access to Widevine, UI should drop down to
|
||||
// prompt user to enable DRM.
|
||||
let result = await SpecialPowers.spawn(browser, [], async function() {
|
||||
try {
|
||||
let config = [
|
||||
{
|
||||
initDataTypes: ["webm"],
|
||||
videoCapabilities: [{ contentType: 'video/webm; codecs="vp9"' }],
|
||||
},
|
||||
];
|
||||
await content.navigator.requestMediaKeySystemAccess(
|
||||
"com.widevine.alpha",
|
||||
config
|
||||
);
|
||||
} catch (ex) {
|
||||
return { rejected: true };
|
||||
}
|
||||
return { rejected: false };
|
||||
});
|
||||
is(
|
||||
result.rejected,
|
||||
true,
|
||||
"EME request should be denied because EME disabled."
|
||||
);
|
||||
|
||||
// Verify the UI prompt did not show.
|
||||
let box = gBrowser.getNotificationBox(browser);
|
||||
let notification = box.currentNotification;
|
||||
|
||||
is(
|
||||
notification,
|
||||
null,
|
||||
"Notification should not be displayed since pref is locked"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -388,8 +388,11 @@ void MediaKeySystemAccessManager::RequestMediaKeySystemAccess(
|
||||
// EME disabled by user, send notification to chrome so UI can inform user.
|
||||
// Clearkey is allowed even when EME is disabled because we want the pref
|
||||
// "media.eme.enabled" only taking effect on proprietary DRMs.
|
||||
MediaKeySystemAccess::NotifyObservers(mWindow, aRequest->mKeySystem,
|
||||
MediaKeySystemStatus::Api_disabled);
|
||||
// We don't show the notification if the pref is locked.
|
||||
if (!Preferences::IsLocked("media.eme.enabled")) {
|
||||
MediaKeySystemAccess::NotifyObservers(mWindow, aRequest->mKeySystem,
|
||||
MediaKeySystemStatus::Api_disabled);
|
||||
}
|
||||
aRequest->RejectPromiseWithNotSupportedError(
|
||||
NS_LITERAL_CSTRING("EME has been preffed off"));
|
||||
diagnostics.StoreMediaKeySystemAccess(
|
||||
|
Loading…
Reference in New Issue
Block a user