summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
Diffstat (limited to 'dom')
-rw-r--r--dom/abort/AbortSignal.cpp9
-rw-r--r--dom/abort/moz.build2
-rw-r--r--dom/bindings/BindingUtils.cpp7
-rw-r--r--dom/html/HTMLMediaElement.cpp14
4 files changed, 28 insertions, 4 deletions
diff --git a/dom/abort/AbortSignal.cpp b/dom/abort/AbortSignal.cpp
index 20f36d2ab..7ee6c49a9 100644
--- a/dom/abort/AbortSignal.cpp
+++ b/dom/abort/AbortSignal.cpp
@@ -56,9 +56,16 @@ AbortSignal::Aborted() const
void
AbortSignal::Abort()
{
- MOZ_ASSERT(!mAborted);
+ // Re-entrancy guard
+ if (mAborted) {
+ return;
+ }
mAborted = true;
+ // We might be deleted as a result of aborting a follower, so ensure we
+ // stay alive until all followers have been aborted.
+ RefPtr<AbortSignal> pinThis = this;
+
// Let's inform the followers.
for (uint32_t i = 0; i < mFollowers.Length(); ++i) {
mFollowers[i]->Aborted();
diff --git a/dom/abort/moz.build b/dom/abort/moz.build
index cb48ee15f..eacc9ddc7 100644
--- a/dom/abort/moz.build
+++ b/dom/abort/moz.build
@@ -14,7 +14,7 @@ EXPORTS.mozilla.dom += [
'AbortSignal.h',
]
-UNIFIED_SOURCES += [
+SOURCES += [
'AbortController.cpp',
'AbortSignal.cpp',
]
diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp
index ee321772e..aeccc84bc 100644
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -2516,6 +2516,12 @@ ConstructJSImplementation(const char* aContractId,
{
AutoNoJSAPI nojsapi;
+ nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
+ if (!window->IsCurrentInnerWindow()) {
+ aRv.Throw(NS_ERROR_FAILURE);
+ return;
+ }
+
// Get the XPCOM component containing the JS implementation.
nsresult rv;
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
@@ -2530,7 +2536,6 @@ ConstructJSImplementation(const char* aContractId,
// and our global is a window.
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
do_QueryInterface(implISupports);
- nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
if (gpi) {
JS::Rooted<JS::Value> initReturn(RootingCx());
rv = gpi->Init(window, &initReturn);
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index cbb86edac..c7306b98e 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);