Bug 1278198 - Update navigator.requestMediaKeySystemAccess() MOZ_LOG to log new EME WebIDL attributes. r=gerald
MozReview-Commit-ID: 8V5YbJP0lFA
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -2581,67 +2581,96 @@ Navigator::GetUserAgent(nsPIDOMWindowInn
return siteSpecificUA->GetUserAgentForURIAndWindow(aURI, aWindow, aUserAgent);
}
#ifdef MOZ_EME
static nsCString
ToCString(const nsString& aString)
{
- return NS_ConvertUTF16toUTF8(aString);
+ nsCString str("'");
+ str.Append(NS_ConvertUTF16toUTF8(aString));
+ str.AppendLiteral("'");
+ return str;
+}
+
+static nsCString
+ToCString(const MediaKeysRequirement aValue)
+{
+ nsCString str("'");
+ str.Append(nsDependentCString(MediaKeysRequirementValues::strings[static_cast<uint32_t>(aValue)].value));
+ str.AppendLiteral("'");
+ return str;
}
static nsCString
ToCString(const MediaKeySystemMediaCapability& aValue)
{
nsCString str;
- str.AppendLiteral("{contentType='");
- if (!aValue.mContentType.IsEmpty()) {
- str.Append(ToCString(aValue.mContentType));
- }
- str.AppendLiteral("'}");
+ str.AppendLiteral("{contentType=");
+ str.Append(ToCString(aValue.mContentType));
+ str.AppendLiteral(", robustness=");
+ str.Append(ToCString(aValue.mRobustness));
+ str.AppendLiteral("}");
return str;
}
template<class Type>
static nsCString
ToCString(const Sequence<Type>& aSequence)
{
- nsCString s;
- s.AppendLiteral("[");
+ nsCString str;
+ str.AppendLiteral("[");
for (size_t i = 0; i < aSequence.Length(); i++) {
if (i != 0) {
- s.AppendLiteral(",");
+ str.AppendLiteral(",");
}
- s.Append(ToCString(aSequence[i]));
+ str.Append(ToCString(aSequence[i]));
}
- s.AppendLiteral("]");
- return s;
+ str.AppendLiteral("]");
+ return str;
+}
+
+template<class Type>
+static nsCString
+ToCString(const Optional<Sequence<Type>>& aOptional)
+{
+ nsCString str;
+ if (aOptional.WasPassed()) {
+ str.Append(ToCString(aOptional.Value()));
+ } else {
+ str.AppendLiteral("[]");
+ }
+ return str;
}
static nsCString
ToCString(const MediaKeySystemConfiguration& aConfig)
{
nsCString str;
- str.AppendLiteral("{");
- str.AppendPrintf("label='%s'", NS_ConvertUTF16toUTF8(aConfig.mLabel).get());
-
- if (aConfig.mInitDataTypes.WasPassed()) {
- str.AppendLiteral(", initDataTypes=");
- str.Append(ToCString(aConfig.mInitDataTypes.Value()));
- }
-
- if (aConfig.mAudioCapabilities.WasPassed()) {
- str.AppendLiteral(", audioCapabilities=");
- str.Append(ToCString(aConfig.mAudioCapabilities.Value()));
- }
- if (aConfig.mVideoCapabilities.WasPassed()) {
- str.AppendLiteral(", videoCapabilities=");
- str.Append(ToCString(aConfig.mVideoCapabilities.Value()));
- }
+ str.AppendLiteral("{label=");
+ str.Append(ToCString(aConfig.mLabel));
+
+ str.AppendLiteral(", initDataTypes=");
+ str.Append(ToCString(aConfig.mInitDataTypes));
+
+ str.AppendLiteral(", audioCapabilities=");
+ str.Append(ToCString(aConfig.mAudioCapabilities));
+
+ str.AppendLiteral(", videoCapabilities=");
+ str.Append(ToCString(aConfig.mVideoCapabilities));
+
+ str.AppendLiteral(", distinctiveIdentifier=");
+ str.Append(ToCString(aConfig.mDistinctiveIdentifier));
+
+ str.AppendLiteral(", persistentState=");
+ str.Append(ToCString(aConfig.mPersistentState));
+
+ str.AppendLiteral(", sessionTypes=");
+ str.Append(ToCString(aConfig.mSessionTypes));
str.AppendLiteral("}");
return str;
}
static nsCString
RequestKeySystemAccessLogString(const nsAString& aKeySystem,