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-16 12:03:38 +00:00
parent 956ae41379
commit de02494b5b
3 changed files with 77 additions and 1 deletions

View File

@@ -2354,7 +2354,24 @@ void HTMLMediaElement::NoSupportedMediaSourceError(
if (mDecoder) {
ShutdownDecoder();
}
mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
bool isThirdPartyLoad = false;
nsresult rv = NS_ERROR_NOT_AVAILABLE;
if (mSrcAttrTriggeringPrincipal) {
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();