Bug 1159755. Stop forcing the media.eme.apiVisible preference to be true in our test harness. r=cpearce

This commit is contained in:
Boris Zbarsky 2015-04-30 17:36:50 -04:00
parent d9ad30e912
commit eaa2b4b2c1
4 changed files with 34 additions and 14 deletions

View File

@ -390,12 +390,13 @@ function SetupEMEPref(callback) {
[ "media.mediasource.enabled", true ],
[ "media.mediasource.whitelist", false ],
[ "media.fragmented-mp4.exposed", true ],
[ "media.eme.apiVisible", true ],
];
if (/Linux/.test(navigator.userAgent)) {
if (/Linux/.test(manifestNavigator().userAgent)) {
prefs.push([ "media.fragmented-mp4.ffmpeg.enabled", true ]);
} else if (SpecialPowers.Services.appinfo.name == "B2G" ||
!document.createElement('video').canPlayType("video/mp4")) {
!manifestVideo().canPlayType("video/mp4")) {
// XXX remove once we have mp4 PlatformDecoderModules on all platforms.
prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
}

View File

@ -2,6 +2,26 @@
// be ignored. To make sure tests respect that, we include a file of type
// "bogus/duh" in each list.
// Make sure to not touch navigator in here, since we want to push prefs that
// will affect the APIs it exposes, but the set of exposed APIs is determined
// when Navigator.prototype is created. So if we touch navigator before pushing
// the prefs, the APIs it exposes will not take those prefs into account. We
// work around this by using a navigator object from a different global for our
// UA string testing.
var gManifestNavigatorSource = document.documentElement.appendChild(document.createElement("iframe"));
gManifestNavigatorSource.style.display = "none";
function manifestNavigator() {
return gManifestNavigatorSource.contentWindow.navigator;
}
// Similarly, use a <video> element from a different global for canPlayType or
// other feature testing. If we used one from our global and did so before our
// prefs are pushed, then we'd instantiate HTMLMediaElement.prototype before the
// prefs are pushed and APIs we expect to be on that object would not be there.
function manifestVideo() {
return gManifestNavigatorSource.contentDocument.createElement('video');
}
// These are small test files, good for just seeing if something loads. We
// really only need one test file per backend here.
var gSmallTests = [
@ -334,7 +354,7 @@ var gOggTrackInfoResults = {
// we've specified.
function fileUriToSrc(path, mustExist) {
// android mochitest doesn't support file://
if (navigator.appVersion.indexOf("Android") != -1 || SpecialPowers.Services.appinfo.name == "B2G")
if (manifestNavigator().appVersion.indexOf("Android") != -1 || SpecialPowers.Services.appinfo.name == "B2G")
return path;
const Ci = SpecialPowers.Ci;
@ -458,7 +478,7 @@ var gFastSeekTests = [
function IsWindows8OrLater() {
var re = /Windows NT (\d.\d)/;
var winver = navigator.userAgent.match(re);
var winver = manifestNavigator().userAgent.match(re);
return winver && winver.length == 2 && parseFloat(winver[1]) >= 6.2;
}
@ -473,7 +493,7 @@ var androidVersion = SpecialPowers.Cc['@mozilla.org/system-info;1']
.getService(SpecialPowers.Ci.nsIPropertyBag2)
.getProperty('version');
// Fragmented MP4.
if (navigator.userAgent.indexOf("Mobile") != -1 && androidVersion >= 18) {
if (manifestNavigator().userAgent.indexOf("Mobile") != -1 && androidVersion >= 18) {
gUnseekableTests = gUnseekableTests.concat([
{ name:"street.mp4", type:"video/mp4" }
]);
@ -1049,4 +1069,4 @@ function setMediaTestsPrefs(callback, extraPrefs) {
SpecialPowers.pushPrefEnv({"set": prefs}, callback);
}
SimpleTest.requestFlakyTimeout("untriaged");
SimpleTest.requestFlakyTimeout("untriaged");

View File

@ -665,19 +665,19 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"MediaError",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeyError", pref: "media.eme.apiVisible"},
{name: "MediaKeyError", android: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaEncryptedEvent", pref: "media.eme.apiVisible"},
{name: "MediaEncryptedEvent", android: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeys", pref: "media.eme.apiVisible"},
{name: "MediaKeys", android: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeySession", pref: "media.eme.apiVisible"},
{name: "MediaKeySession", android: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeySystemAccess", pref: "media.eme.apiVisible"},
{name: "MediaKeySystemAccess", android: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeyMessageEvent", pref: "media.eme.apiVisible"},
{name: "MediaKeyMessageEvent", android: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "MediaKeyStatusMap", pref: "media.eme.apiVisible"},
{name: "MediaKeyStatusMap", android: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
"MediaList",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -292,7 +292,6 @@ user_pref("browser.search.countryCode", "US");
user_pref("browser.selfsupport.url", "https://%(server)s/selfsupport-dummy/");
user_pref("media.eme.enabled", true);
user_pref("media.eme.apiVisible", true);
#if defined(XP_WIN)
user_pref("media.decoder.heuristic.dormant.timeout", 0);