Bug 1185611: [MSE] P1. Remove whitelist. r=kinetik

We are now confident enough that MediaSource is usable by all
This commit is contained in:
Jean-Yves Avenard 2015-07-31 09:48:09 +10:00
parent b9311d44e4
commit 244a71b296
53 changed files with 48 additions and 104 deletions

View File

@ -18,14 +18,10 @@
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/mozalloc.h"
#include "nsContentTypeParser.h"
#include "nsContentUtils.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsIEffectiveTLDService.h"
#include "nsIRunnable.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIURI.h"
#include "nsNetCID.h"
#include "nsPIDOMWindow.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@ -341,46 +337,7 @@ MediaSource::IsTypeSupported(const GlobalObject&, const nsAString& aType)
/* static */ bool
MediaSource::Enabled(JSContext* cx, JSObject* aGlobal)
{
MOZ_ASSERT(NS_IsMainThread());
// Don't use aGlobal across Preferences stuff, which the static
// analysis thinks can GC.
JS::Rooted<JSObject*> global(cx, aGlobal);
bool enabled = Preferences::GetBool("media.mediasource.enabled");
if (!enabled) {
return false;
}
// Check whether it's enabled everywhere or just whitelisted sites.
bool restrict = Preferences::GetBool("media.mediasource.whitelist", false);
if (!restrict) {
return true;
}
// We want to restrict to YouTube only.
// We define that as the origin being *.youtube.com.
// We also support *.youtube-nocookie.com
nsIPrincipal* principal = nsContentUtils::ObjectPrincipal(global);
nsCOMPtr<nsIURI> uri;
if (NS_FAILED(principal->GetURI(getter_AddRefs(uri))) || !uri) {
return false;
}
nsCOMPtr<nsIEffectiveTLDService> tldServ =
do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
NS_ENSURE_TRUE(tldServ, false);
nsAutoCString eTLDplusOne;
if (NS_FAILED(tldServ->GetBaseDomain(uri, 0, eTLDplusOne))) {
return false;
}
return eTLDplusOne.EqualsLiteral("youtube.com") ||
eTLDplusOne.EqualsLiteral("youtube-nocookie.com") ||
eTLDplusOne.EqualsLiteral("netflix.com") ||
eTLDplusOne.EqualsLiteral("dailymotion.com") ||
eTLDplusOne.EqualsLiteral("dmcdn.net");
return Preferences::GetBool("media.mediasource.enabled");
}
bool

View File

@ -6,7 +6,6 @@
/*
user_pref("media.mediasource.enabled", true);
user_pref("media.mediasource.whitelist", false);
*/
function boom()

View File

@ -5,7 +5,6 @@
/*
user_pref("media.mediasource.enabled", true);
user_pref("media.mediasource.whitelist", false);
*/
function boom()

View File

@ -1,4 +1,4 @@
test-pref(media.mediasource.enabled,true) test-pref(media.mediasource.whitelist,false) load 926665.html
test-pref(media.mediasource.enabled,true) test-pref(media.mediasource.whitelist,false) load 931388.html
test-pref(media.mediasource.enabled,true) test-pref(media.mediasource.whitelist,false) load 1005366.html
test-pref(media.mediasource.enabled,true) test-pref(media.mediasource.whitelist,false) load 1059035.html
test-pref(media.mediasource.enabled,true) load 926665.html
test-pref(media.mediasource.enabled,true) load 931388.html
test-pref(media.mediasource.enabled,true) load 1005366.html
test-pref(media.mediasource.enabled,true) load 1059035.html

View File

@ -19,7 +19,6 @@ function runWithMSE(testFunction) {
addLoadEvent(function () {
SpecialPowers.pushPrefEnv({"set": [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.whitelist", false ],
]},
bootstrapTest);
});

View File

@ -22,7 +22,6 @@ function test() {
SpecialPowers.pushPrefEnv({"set":
[
["media.mediasource.enabled", false],
["media.mediasource.whitelist", false],
]
},
test);

View File

@ -399,7 +399,6 @@ function SetupEME(test, token, params)
function SetupEMEPref(callback) {
var prefs = [
[ "media.mediasource.enabled", true ],
[ "media.mediasource.whitelist", false ],
[ "media.fragmented-mp4.exposed", true ],
[ "media.eme.apiVisible", true ],
];

View File

@ -54,7 +54,6 @@ addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set":
[
["media.mediasource.enabled", true],
["media.mediasource.whitelist", false],
]
}, test);
});

View File

@ -28,7 +28,6 @@ addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set":
[
["media.mediasource.enabled", false],
["media.mediasource.whitelist", false],
]
}, test);
});

View File

@ -471,12 +471,6 @@ pref("media.mediasource.enabled", true);
pref("media.mediasource.enabled", false);
#endif
#ifdef RELEASE_BUILD
pref("media.mediasource.whitelist", true);
#else
pref("media.mediasource.whitelist", false);
#endif // RELEASE_BUILD
pref("media.mediasource.mp4.enabled", true);
pref("media.mediasource.webm.enabled", false);

View File

@ -1,6 +1,6 @@
[SourceBuffer-abort-readyState.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[SourceBuffer#abort() (video/webm; codecs="vorbis,vp8") : If the readyState attribute of the parent media source is not in the "open" state then throw an INVALID_STATE_ERR exception and abort these steps.]
expected: FAIL

View File

@ -1,6 +1,6 @@
[SourceBuffer-abort-removed.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[SourceBuffer#abort (video/webm; codecs="vorbis,vp8") : if this object has been removed from the sourceBuffers attribute of the parent media source, then throw an INVALID_STATE_ERR exception and abort these steps.]
expected: FAIL

View File

@ -1,6 +1,6 @@
[SourceBuffer-abort-updating.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[SourceBuffer#abort() (video/webm; codecs="vorbis,vp8") : Check the algorithm when the updating attribute is true.]
expected: FAIL

View File

@ -1,6 +1,6 @@
[SourceBuffer-abort.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[SourceBuffer#abort() (video/webm; codecs="vorbis,vp8"): Check the values of appendWindowStart and appendWindowEnd.]
expected: FAIL

View File

@ -1,3 +1,3 @@
[URL-createObjectURL-revoke.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]

View File

@ -1,6 +1,6 @@
[URL-createObjectURL.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[URL.createObjectURL(mediaSource) should return a unique Blob URI.]
expected: FAIL

View File

@ -1,4 +1,4 @@
[interfaces.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
expected: ERROR

View File

@ -1,6 +1,6 @@
[mediasource-addsourcebuffer.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test addSourceBuffer() with Vorbis and VP8]
expected: FAIL

View File

@ -1,6 +1,6 @@
[mediasource-append-buffer.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test SourceBuffer.appendBuffer() event dispatching.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-appendwindow.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test correctly reset appendWindowStart and appendWindowEnd values]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-buffered.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled:
if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1182945
if (os == "win") and (version == "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1182945

View File

@ -1,6 +1,6 @@
[mediasource-closed.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test addSourceBuffer() while closed.]
expected:
if os == "linux": FAIL

View File

@ -1,4 +1,4 @@
[mediasource-config-change-mp4-a-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1130973

View File

@ -1,4 +1,4 @@
[mediasource-config-change-mp4-av-audio-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1130973

View File

@ -1,6 +1,6 @@
[mediasource-config-change-mp4-av-framesize.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Tests mp4 frame size changes in multiplexed content.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-config-change-mp4-av-video-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Tests mp4 video bitrate changes in multiplexed content.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-config-change-mp4-v-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Tests mp4 video-only bitrate changes.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-config-change-mp4-v-framerate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Tests mp4 video-only frame rate changes.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-config-change-mp4-v-framesize.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Tests mp4 video-only frame size changes.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-config-change-webm-a-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled:
if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1186261
if (os == "win") and (version == "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1186261

View File

@ -1,6 +1,6 @@
[mediasource-config-change-webm-av-audio-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Tests webm audio bitrate changes in multiplexed content.]
expected: FAIL

View File

@ -1,6 +1,6 @@
[mediasource-config-change-webm-av-framesize.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled:
if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1186261
if (os == "win") and (version == "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1186261

View File

@ -1,6 +1,6 @@
[mediasource-config-change-webm-av-video-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Tests webm video bitrate changes in multiplexed content.]
expected: FAIL

View File

@ -1,6 +1,6 @@
[mediasource-config-change-webm-v-bitrate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled:
if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1186261
if (os == "win") and (version == "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1186261

View File

@ -1,6 +1,6 @@
[mediasource-config-change-webm-v-framerate.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled:
if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1186261
if (os == "win") and (version == "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1186261

View File

@ -1,6 +1,6 @@
[mediasource-config-change-webm-v-framesize.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled:
if os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1186261
if (os == "win") and (version == "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1186261

View File

@ -1,6 +1,6 @@
[mediasource-duration-boundaryconditions.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Set duration to 2^31 - 1]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-duration.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test seek starts on duration truncation below currentTime]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1148224

View File

@ -1,3 +1,3 @@
[mediasource-endofstream-invaliderror.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]

View File

@ -1,6 +1,6 @@
[mediasource-getvideoplaybackquality.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-is-type-supported.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test valid WebM type "video/webm;codecs="vp8""]
expected: FAIL

View File

@ -1,3 +1,3 @@
[mediasource-multiple-attach.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]

View File

@ -1,4 +1,4 @@
[mediasource-play-then-seek-back.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1128069

View File

@ -1,6 +1,6 @@
[mediasource-play.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test normal playback case with MediaSource API]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-redundant-seek.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test redundant fully prebuffered seek]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-remove.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test removing all appended data.]
expected: FAIL

View File

@ -1,6 +1,6 @@
[mediasource-removesourcebuffer.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test addSourceBuffer(), removeSourceBuffer(), addSourceBuffer() sequence.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-seek-beyond-duration.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1093945
[Test seeking beyond updated media duration.]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1093945

View File

@ -1,6 +1,6 @@
[mediasource-seek-during-pending-seek.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
disabled:
if os == "mac": https://bugzilla.mozilla.org/show_bug.cgi?id=1183523
if (os == "win") and (version != "5.1.2600"): https://bugzilla.mozilla.org/show_bug.cgi?id=1183523

View File

@ -1,6 +1,6 @@
[mediasource-sequencemode-append-buffer.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test sequence AppendMode appendBuffer(first media segment)]
expected: FAIL

View File

@ -1,6 +1,6 @@
[mediasource-sourcebuffer-mode.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test initial value of SourceBuffer.mode is "segments"]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-sourcebufferlist.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test SourceBufferList event dispatching.]
expected:
if os == "linux": FAIL

View File

@ -1,6 +1,6 @@
[mediasource-timestamp-offset.html]
type: testharness
prefs: [media.mediasource.enabled:true, media.mediasource.whitelist:false]
prefs: [media.mediasource.enabled:true]
[Test setting SourceBuffer.timestampOffset to a positive number.]
expected:
if os == "linux": FAIL