diff --git a/dom/media/test/eme.js b/dom/media/test/eme.js index d5fd0a4d2afa..50a66b1642d6 100644 --- a/dom/media/test/eme.js +++ b/dom/media/test/eme.js @@ -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 ]); } diff --git a/dom/media/test/manifest.js b/dom/media/test/manifest.js index 5a3fac5aca28..695aa1d7ed7e 100644 --- a/dom/media/test/manifest.js +++ b/dom/media/test/manifest.js @@ -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