From 0fd831e559d4b58f2b550f78fb78e79b197e0d8e Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 15 Sep 2016 11:41:35 -0400 Subject: [PATCH] Bug 1302304. Remove IDL bits that reference nsIDOMMediaError; it's not needed anymore. r=bkelly --- dom/base/nsDOMClassInfo.cpp | 1 - dom/html/HTMLMediaElement.cpp | 35 +++++++++---------- dom/html/MediaError.cpp | 15 ++------ dom/html/MediaError.h | 8 ++--- dom/interfaces/html/moz.build | 1 - .../html/nsIDOMHTMLMediaElement.idl | 4 --- dom/interfaces/html/nsIDOMMediaError.idl | 29 --------------- dom/media/eme/MediaKeys.h | 1 - dom/webidl/MediaError.webidl | 1 + .../tests/mochitest/test_bug790732.html | 1 - xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp | 3 -- 11 files changed, 24 insertions(+), 75 deletions(-) delete mode 100644 dom/interfaces/html/nsIDOMMediaError.idl diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index fa324674e4ac..b61fe1f94882 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1889,7 +1889,6 @@ const InterfaceShimEntry kInterfaceShimMap[] = { "nsIDOMSimpleGestureEvent", "SimpleGestureEvent" }, { "nsIDOMUIEvent", "UIEvent" }, { "nsIDOMHTMLMediaElement", "HTMLMediaElement" }, - { "nsIDOMMediaError", "MediaError" }, { "nsIDOMOfflineResourceList", "OfflineResourceList" }, { "nsIDOMRange", "Range" }, { "nsIDOMSVGLength", "SVGLength" }, diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index b3abd46abcb2..465fa4bdba6f 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -85,6 +85,7 @@ #include "mozilla/dom/AudioTrack.h" #include "mozilla/dom/AudioTrackList.h" +#include "mozilla/dom/MediaErrorBinding.h" #include "mozilla/dom/VideoTrack.h" #include "mozilla/dom/VideoTrackList.h" #include "mozilla/dom/TextTrack.h" @@ -162,6 +163,12 @@ static const double THRESHOLD_HIGH_PLAYBACKRATE_AUDIO = 4.0; // Threshold under which audio is muted static const double THRESHOLD_LOW_PLAYBACKRATE_AUDIO = 0.5; +// Media error values. These need to match the ones in MediaError.webidl. +static const unsigned short MEDIA_ERR_ABORTED = 1; +static const unsigned short MEDIA_ERR_NETWORK = 2; +static const unsigned short MEDIA_ERR_DECODE = 3; +static const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4; + // Under certain conditions there may be no-one holding references to // a media element from script, DOM parent, etc, but the element may still // fire meaningful events in the future so we can't destroy it yet: @@ -871,13 +878,6 @@ NS_IMETHODIMP HTMLMediaElement::GetMozAutoplayEnabled(bool *aAutoplayEnabled) return NS_OK; } -NS_IMETHODIMP HTMLMediaElement::GetError(nsIDOMMediaError * *aError) -{ - NS_IF_ADDREF(*aError = mError); - - return NS_OK; -} - bool HTMLMediaElement::Ended() { @@ -1045,7 +1045,7 @@ void HTMLMediaElement::NoSupportedMediaSourceError() NS_ASSERTION(mNetworkState == NETWORK_LOADING, "Not loading during source selection?"); - mError = new MediaError(this, nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); + mError = new MediaError(this, MEDIA_ERR_SRC_NOT_SUPPORTED); ChangeNetworkState(nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE); DispatchAsyncEvent(NS_LITERAL_STRING("error")); ChangeDelayLoadStatus(false); @@ -4416,7 +4416,7 @@ void HTMLMediaElement::NetworkError() if (mDecoder) { ShutdownDecoder(); } - Error(nsIDOMMediaError::MEDIA_ERR_NETWORK); + Error(MEDIA_ERR_NETWORK); } void HTMLMediaElement::DecodeError(const MediaResult& aError) @@ -4443,7 +4443,7 @@ void HTMLMediaElement::DecodeError(const MediaResult& aError) NS_WARNING("Should know the source we were loading from!"); } } else { - Error(nsIDOMMediaError::MEDIA_ERR_DECODE, aError); + Error(MEDIA_ERR_DECODE, aError); } } @@ -4454,16 +4454,16 @@ bool HTMLMediaElement::HasError() const void HTMLMediaElement::LoadAborted() { - Error(nsIDOMMediaError::MEDIA_ERR_ABORTED); + Error(MEDIA_ERR_ABORTED); } void HTMLMediaElement::Error(uint16_t aErrorCode, const MediaResult& aErrorDetails) { - NS_ASSERTION(aErrorCode == nsIDOMMediaError::MEDIA_ERR_DECODE || - aErrorCode == nsIDOMMediaError::MEDIA_ERR_NETWORK || - aErrorCode == nsIDOMMediaError::MEDIA_ERR_ABORTED, - "Only use nsIDOMMediaError codes!"); + NS_ASSERTION(aErrorCode == MEDIA_ERR_DECODE || + aErrorCode == MEDIA_ERR_NETWORK || + aErrorCode == MEDIA_ERR_ABORTED, + "Only use MediaError codes!"); // Since we have multiple paths calling into DecodeError, e.g. // MediaKeys::Terminated and EMEH264Decoder::Error. We should take the 1st @@ -6488,10 +6488,9 @@ HTMLMediaElement::HaveFailedWithSourceNotSupportedError() const return false; } - uint16_t errorCode; - mError->GetCode(&errorCode); + uint16_t errorCode = mError->Code(); return (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE && - errorCode == nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); + errorCode == MEDIA_ERR_SRC_NOT_SUPPORTED); } void diff --git a/dom/html/MediaError.cpp b/dom/html/MediaError.cpp index f4a913a97567..83b9ffc5fe5a 100644 --- a/dom/html/MediaError.cpp +++ b/dom/html/MediaError.cpp @@ -17,8 +17,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaError) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaError) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsIDOMMediaError) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaError) + NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END MediaError::MediaError(HTMLMediaElement* aParent, uint16_t aCode, @@ -29,18 +28,10 @@ MediaError::MediaError(HTMLMediaElement* aParent, uint16_t aCode, { } -NS_IMETHODIMP MediaError::GetCode(uint16_t* aCode) -{ - if (aCode) - *aCode = Code(); - - return NS_OK; -} - -NS_IMETHODIMP MediaError::GetMessage(nsAString& aResult) +void +MediaError::GetMessage(nsAString& aResult) const { CopyUTF8toUTF16(mMessage, aResult); - return NS_OK; } JSObject* diff --git a/dom/html/MediaError.h b/dom/html/MediaError.h index cebe01efdeb2..27be1050edfd 100644 --- a/dom/html/MediaError.h +++ b/dom/html/MediaError.h @@ -7,7 +7,6 @@ #ifndef mozilla_dom_MediaError_h #define mozilla_dom_MediaError_h -#include "nsIDOMMediaError.h" #include "mozilla/dom/HTMLMediaElement.h" #include "nsWrapperCache.h" #include "nsISupports.h" @@ -16,7 +15,7 @@ namespace mozilla { namespace dom { -class MediaError final : public nsIDOMMediaError, +class MediaError final : public nsISupports, public nsWrapperCache { ~MediaError() {} @@ -29,9 +28,6 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaError) - // nsIDOMMediaError - NS_DECL_NSIDOMMEDIAERROR - HTMLMediaElement* GetParentObject() const { return mParent; @@ -44,6 +40,8 @@ public: return mCode; } + void GetMessage(nsAString& aResult) const; + private: RefPtr mParent; diff --git a/dom/interfaces/html/moz.build b/dom/interfaces/html/moz.build index 68c927506712..895a8731490e 100644 --- a/dom/interfaces/html/moz.build +++ b/dom/interfaces/html/moz.build @@ -51,7 +51,6 @@ XPIDL_SOURCES += [ 'nsIDOMHTMLTableCellElement.idl', 'nsIDOMHTMLTextAreaElement.idl', 'nsIDOMHTMLUListElement.idl', - 'nsIDOMMediaError.idl', 'nsIDOMMozBrowserFrame.idl', 'nsIDOMTimeRanges.idl', 'nsIDOMValidityState.idl', diff --git a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl index d362cef42629..68c15c00c0df 100644 --- a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl @@ -5,7 +5,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIDOMHTMLElement.idl" -#include "nsIDOMMediaError.idl" #include "nsIDOMTimeRanges.idl" /** @@ -31,9 +30,6 @@ native Visibility(mozilla::Visibility); [uuid(c041d76c-15ce-47ad-b61d-e8755a6db638)] interface nsIDOMHTMLMediaElement : nsISupports { - // error state - readonly attribute nsIDOMMediaError error; - // network state attribute DOMString src; readonly attribute DOMString currentSrc; diff --git a/dom/interfaces/html/nsIDOMMediaError.idl b/dom/interfaces/html/nsIDOMMediaError.idl deleted file mode 100644 index 39488dfd6f8b..000000000000 --- a/dom/interfaces/html/nsIDOMMediaError.idl +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "domstubs.idl" - -[uuid(7bd8c29f-8a76-453f-9373-79f820f2dc01)] -interface nsIDOMMediaError : nsISupports -{ - /* The download of the media resource was aborted by - the user agent at the user's requet */ - const unsigned short MEDIA_ERR_ABORTED = 1; - - /* A network error of some description caused the - user agent to stop downloading the media resource */ - const unsigned short MEDIA_ERR_NETWORK = 2; - - /* An error of some description occurred while decoding - the media resource */ - const unsigned short MEDIA_ERR_DECODE = 3; - - /* No suitable media resource could be found */ - const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4; - - readonly attribute unsigned short code; - - readonly attribute DOMString message; -}; diff --git a/dom/media/eme/MediaKeys.h b/dom/media/eme/MediaKeys.h index c8cd1639bd7a..bddd624e3bac 100644 --- a/dom/media/eme/MediaKeys.h +++ b/dom/media/eme/MediaKeys.h @@ -7,7 +7,6 @@ #ifndef mozilla_dom_mediakeys_h__ #define mozilla_dom_mediakeys_h__ -#include "nsIDOMMediaError.h" #include "nsWrapperCache.h" #include "nsISupports.h" #include "mozilla/Attributes.h" diff --git a/dom/webidl/MediaError.webidl b/dom/webidl/MediaError.webidl index 3b8a0bbe948f..4c575e543906 100644 --- a/dom/webidl/MediaError.webidl +++ b/dom/webidl/MediaError.webidl @@ -12,6 +12,7 @@ */ interface MediaError { + // Keep these constants in sync with the ones defined in HTMLMediaElement.h const unsigned short MEDIA_ERR_ABORTED = 1; const unsigned short MEDIA_ERR_NETWORK = 2; const unsigned short MEDIA_ERR_DECODE = 3; diff --git a/js/xpconnect/tests/mochitest/test_bug790732.html b/js/xpconnect/tests/mochitest/test_bug790732.html index 7938a3bd8bde..48b7fdbb6d12 100644 --- a/js/xpconnect/tests/mochitest/test_bug790732.html +++ b/js/xpconnect/tests/mochitest/test_bug790732.html @@ -35,7 +35,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=790732 is(Ci.nsIDOMSimpleGestureEvent, SimpleGestureEvent); is(Ci.nsIDOMUIEvent, UIEvent); is(Ci.nsIDOMHTMLMediaElement, HTMLMediaElement); - is(Ci.nsIDOMMediaError, MediaError); is(Ci.nsIDOMOfflineResourceList, OfflineResourceList); is(Ci.nsIDOMRange, Range); is(Ci.nsIDOMSVGLength, SVGLength); diff --git a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp index 4547f6019ab6..9bb51eabd3d7 100644 --- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp +++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp @@ -93,7 +93,6 @@ #include "nsIDOMHTMLTextAreaElement.h" #include "nsIDOMHTMLUListElement.h" #include "nsIDOMKeyEvent.h" -#include "nsIDOMMediaError.h" #include "nsIDOMMediaList.h" #include "nsIDOMMouseEvent.h" #include "nsIDOMMouseScrollEvent.h" @@ -225,7 +224,6 @@ #include "mozilla/dom/HTMLUListElementBinding.h" #include "mozilla/dom/KeyEventBinding.h" #include "mozilla/dom/ListBoxObjectBinding.h" -#include "mozilla/dom/MediaErrorBinding.h" #include "mozilla/dom/MediaListBinding.h" #include "mozilla/dom/MessageEventBinding.h" #include "mozilla/dom/MenuBoxObjectBinding.h" @@ -414,7 +412,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] = DEFINE_SHIM(HTMLUListElement), DEFINE_SHIM(KeyEvent), DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject), - DEFINE_SHIM(MediaError), DEFINE_SHIM(MediaList), DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIMenuBoxObject, MenuBoxObject), DEFINE_SHIM(MouseEvent),