Bug 1450853 - Use Generic Error for 3rdparty MediaElement r=ckerschb,smaug

***
Add test

Differential Revision: https://phabricator.services.mozilla.com/D80080
This commit is contained in:
Sebastian Streich
2020-07-14 11:16:24 +00:00
parent 59cca30dab
commit 7d6032bb76
3 changed files with 73 additions and 1 deletions

View File

@@ -2351,7 +2351,20 @@ void HTMLMediaElement::NoSupportedMediaSourceError(
if (mDecoder) {
ShutdownDecoder();
}
mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
bool isThirdPartyLoad = false;
nsresult rv = mSrcAttrTriggeringPrincipal->IsThirdPartyURI(mLoadingSrc,
&isThirdPartyLoad);
if (NS_SUCCEEDED(rv) && isThirdPartyLoad) {
// aErrorDetails can include sensitive details like MimeType or HTTP Status
// Code. In case we're loading a 3rd party resource we should not leak this
// and pass a Generic Error Message
mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED,
"Failed to open media"_ns);
} else {
mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
}
RemoveMediaTracks();
ChangeDelayLoadStatus(false);
UpdateAudioChannelPlayingState();