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() { add_task(async function testAudioDecodingInUtility() {
// TODO: When getting rid of audio decoding on non utility at all, this // TODO: When getting rid of audio decoding on non utility at all, this
// should be removed // should be removed
const verifyForUtility = !!isNightly(); // We only lock the preference in Nightly builds so far, but on beta we expect
await runTest({ expectUtility: verifyForUtility }); // 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( const isAudioDecodingNonUtilityAllowed = await SpecialPowers.getBoolPref(
"media.allow-audio-non-utility" "media.allow-audio-non-utility"
); );
if (isNightly()) { if (isNightlyOrEalyBeta()) {
ok( ok(
!isAudioDecodingNonUtilityAllowed, !isAudioDecodingNonUtilityAllowed,
"Audio decoding should not be allowed on non utility processes by default on Nightly" "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() { add_task(async function testFailureAudioDecodingInContent() {
// TODO: When getting rid of audio decoding on non utility at all, this // TODO: When getting rid of audio decoding on non utility at all, this
// should be removed // should be removed
if (!isNightly()) { if (!isNightlyOrEalyBeta()) {
return; 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 // TODO: This needs to be removed when getting rid of ability to decode on
// non utility at all // non utility at all
if (allowNonUtility || !isNightly()) { if (allowNonUtility || !isNightlyOrEalyBeta()) {
extraKey += ",allow-non-utility"; extraKey += ",allow-non-utility";
} }
return extraKey; return extraKey;

View file

@ -558,10 +558,23 @@ async function crashSomeUtilityActor(
return crashSomeUtility(utilityPid, actorsCheck); return crashSomeUtility(utilityPid, actorsCheck);
} }
function versionContains(e) { function isNightlyOnly() {
return Services.appinfo.platformVersion.indexOf(e) > -1; const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
return AppConstants.NIGHTLY_BUILD;
} }
function isNightly() { function isBetaOnly() {
return versionContains("a"); 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. # We do that only on nightly builds for now.
- name: media.allow-audio-non-utility - name: media.allow-audio-non-utility
type: RelaxedAtomicBool type: RelaxedAtomicBool
#if defined(NIGHTLY_BUILD) #if defined(NIGHTLY_BUILD) || defined(EARLY_BETA_OR_EARLIER)
value: false value: false
#else #else
value: true value: true
#endif // defined(NIGHTLY_BUILD) #endif // defined(NIGHTLY_BUILD) || defined(EARLY_BETA_OR_EARLIER)
mirror: always mirror: always
#ifdef MOZ_OMX #ifdef MOZ_OMX