Bug 1360438 Add telemetry to report whether navigator.requestMediaKeySystemAccess() was called in a secure context. r=bz,francois

The EME spec requires EME to be only usuable from a secure context, for example
from an origin served over HTTPS. We still don't enforce this, and Chrome is
going to start enforcing this in M58. So to inform our decision as to when to
start enforcing this, it would be useful to know how many sites we'd break if
we started enforcing this.

So this patch adds telemetry to tell us the how often EME is used on secure
and non-secure contexts.

MozReview-Commit-ID: BKS5iY4V3wK

--HG--
extra : rebase_source : 77b98516e0d8a0471f8c7a1e5bf54bcf9f74b7da
This commit is contained in:
Chris Pearce 2017-04-28 17:46:30 +12:00
Родитель 7fdb378650
Коммит 66aae8a48f
2 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -1997,14 +1997,17 @@ ToCString(const MediaKeySystemConfiguration& aConfig)
}
static nsCString
RequestKeySystemAccessLogString(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs)
RequestKeySystemAccessLogString(
const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
bool aIsSecureContext)
{
nsCString str;
str.AppendPrintf("Navigator::RequestMediaKeySystemAccess(keySystem='%s' options=",
NS_ConvertUTF16toUTF8(aKeySystem).get());
str.Append(ToCString(aConfigs));
str.AppendLiteral(")");
str.AppendLiteral(") secureContext=");
str.AppendInt(aIsSecureContext);
return str;
}
@ -2013,7 +2016,13 @@ Navigator::RequestMediaKeySystemAccess(const nsAString& aKeySystem,
const Sequence<MediaKeySystemConfiguration>& aConfigs,
ErrorResult& aRv)
{
EME_LOG("%s", RequestKeySystemAccessLogString(aKeySystem, aConfigs).get());
EME_LOG("%s",
RequestKeySystemAccessLogString(
aKeySystem, aConfigs, mWindow->IsSecureContext())
.get());
Telemetry::Accumulate(Telemetry::MEDIA_EME_SECURE_CONTEXT,
mWindow->IsSecureContext());
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
RefPtr<DetailedPromise> promise =

Просмотреть файл

@ -7216,6 +7216,13 @@
"description": "Records a value each time Fennec remote decoding process crashes unexpected while decoding media content.",
"releaseChannelCollection": "opt-out"
},
"MEDIA_EME_SECURE_CONTEXT": {
"alert_emails": ["cpearce@mozilla.com"],
"expires_in_version": "60",
"kind": "boolean",
"description": "Reports whether a navigator.requestMediaKeySystemAccess() was called in a secure context (i.e. on an origin served over HTTPS) or not.",
"bug_numbers": [1360438]
},
"VIDEO_MFT_OUTPUT_NULL_SAMPLES": {
"alert_emails": ["cpearce@mozilla.com"],
"expires_in_version": "53",