summaryrefslogtreecommitdiffstats
path: root/dom/html/HTMLMediaElement.cpp
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-08-31 05:54:39 +0000
committerMoonchild <moonchild@palemoon.org>2020-08-31 05:54:39 +0000
commita6f632714fcb1be3dd00b0fc76fbf6bfc693155b (patch)
treeb04c82f9af4a0d288a6d4350d774ad8fe6dac903 /dom/html/HTMLMediaElement.cpp
parent2ed0607c747b21cadaf7401d4ba706097578e74d (diff)
parentb28effe2ea93e43e362f7ce263d23b55adcb6da7 (diff)
downloadUXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar
UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.gz
UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.lz
UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.tar.xz
UXP-a6f632714fcb1be3dd00b0fc76fbf6bfc693155b.zip
Merge branch 'redwood' into releaseRELBASE_20200831
Diffstat (limited to 'dom/html/HTMLMediaElement.cpp')
-rw-r--r--dom/html/HTMLMediaElement.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index bc63eab51..4abc202a8 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -9,6 +9,7 @@
#include "mozilla/dom/HTMLSourceElement.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/dom/Promise.h"
+#include "mozilla/Preferences.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/AsyncEventDispatcher.h"
@@ -1245,7 +1246,18 @@ void HTMLMediaElement::NoSupportedMediaSourceError(const nsACString& aErrorDetai
if (mDecoder) {
ShutdownDecoder();
}
- mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
+
+ // aErrorDetails can include sensitive details like MimeType or HTTP Status
+ // Code. We should not leak this and pass a Generic Error Message unless the
+ // user has explicitly enabled error reporting for debugging purposes.
+ bool reportDetails = Preferences::GetBool("media.sourceErrorDetails.enabled", false);
+ if (reportDetails) {
+ mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
+ } else {
+ mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED,
+ NS_LITERAL_CSTRING("Failed to open media"));
+ }
+
ChangeDelayLoadStatus(false);
UpdateAudioChannelPlayingState();
RejectPromises(TakePendingPlayPromises(), NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR);