Bug 1850904 - Expand media.allow-audio-non-utility to early beta r=alwu

Differential Revision: https://phabricator.services.mozilla.com/D187174
This commit is contained in:
Alexandre Lissy 2023-09-05 11:27:50 +00:00
parent 9331b9fb07
commit 6d7aed1a40
5 changed files with 25 additions and 11 deletions

View file

@ -19,6 +19,7 @@ add_setup(async function setup() {
add_task(async function testAudioDecodingInUtility() {
// TODO: When getting rid of audio decoding on non utility at all, this
// should be removed
const verifyForUtility = !!isNightly();
await runTest({ expectUtility: verifyForUtility });
// We only lock the preference in Nightly builds so far, but on beta we expect
// audio decoding error
await runTest({ expectUtility: isNightlyOnly(), expectError: isBetaOnly() });
});

View file

@ -14,7 +14,7 @@ add_setup(async function checkAudioDecodingNonUtility() {
const isAudioDecodingNonUtilityAllowed = await SpecialPowers.getBoolPref(
"media.allow-audio-non-utility"
);
if (isNightly()) {
if (isNightlyOrEalyBeta()) {
ok(
!isAudioDecodingNonUtilityAllowed,
"Audio decoding should not be allowed on non utility processes by default on Nightly"
@ -38,7 +38,7 @@ add_task(async function testFailureAudioDecodingInRDD() {
add_task(async function testFailureAudioDecodingInContent() {
// TODO: When getting rid of audio decoding on non utility at all, this
// should be removed
if (!isNightly()) {
if (!isNightlyOrEalyBeta()) {
return;
}

View file

@ -262,7 +262,7 @@ function getExtraKey({ utilityPref, rddPref, allowNonUtility }) {
}
// TODO: This needs to be removed when getting rid of ability to decode on
// non utility at all
if (allowNonUtility || !isNightly()) {
if (allowNonUtility || !isNightlyOrEalyBeta()) {
extraKey += ",allow-non-utility";
}
return extraKey;

View file

@ -558,10 +558,23 @@ async function crashSomeUtilityActor(
return crashSomeUtility(utilityPid, actorsCheck);
}
function versionContains(e) {
return Services.appinfo.platformVersion.indexOf(e) > -1;
function isNightlyOnly() {
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
return AppConstants.NIGHTLY_BUILD;
}
function isNightly() {
return versionContains("a");
function isBetaOnly() {
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
return !AppConstants.NIGHTLY_BUILD && AppConstants.EARLY_BETA_OR_EARLIER;
}
function isNightlyOrEalyBeta() {
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
return AppConstants.NIGHTLY_BUILD || AppConstants.EARLY_BETA_OR_EARLIER;
}

View file

@ -9949,11 +9949,11 @@
# We do that only on nightly builds for now.
- name: media.allow-audio-non-utility
type: RelaxedAtomicBool
#if defined(NIGHTLY_BUILD)
#if defined(NIGHTLY_BUILD) || defined(EARLY_BETA_OR_EARLIER)
value: false
#else
value: true
#endif // defined(NIGHTLY_BUILD)
#endif // defined(NIGHTLY_BUILD) || defined(EARLY_BETA_OR_EARLIER)
mirror: always
#ifdef MOZ_OMX