Bug 1112424 Part 1 - Add moz specific methods to retrieve debug data to media object IDL - r=bz

Bug 1112424 adds an about:media page that gives debug information about HTMLMediaElements
and in particular MediaSource objects that are live inside tabs. This patch adds
methods to the MediaSource and HTMLMediaElement object to return the debug data as a string
that gets displayed directly in the about:media page, inside a <pre> element.
This commit is contained in:
Chris Double 2015-01-29 15:35:55 +13:00
parent 6886b98ce2
commit ee5e1bf2da
6 changed files with 25 additions and 0 deletions

View File

@ -515,6 +515,16 @@ HTMLMediaElement::IsVideo()
return false;
}
already_AddRefed<MediaSource>
HTMLMediaElement::GetMozMediaSourceObject() const
{
nsRefPtr<MediaSource> source;
if (IsMediaSourceURI(mLoadingSrc)) {
NS_GetSourceForMediaSourceURI(mLoadingSrc, getter_AddRefs(source));
}
return source.forget();
}
already_AddRefed<DOMMediaStream>
HTMLMediaElement::GetMozSrcObject() const
{

View File

@ -533,6 +533,7 @@ public:
mIsCasting = aShow;
}
already_AddRefed<MediaSource> GetMozMediaSourceObject() const;
already_AddRefed<DOMMediaStream> GetMozSrcObject() const;
void SetMozSrcObject(DOMMediaStream& aValue);

View File

@ -540,6 +540,12 @@ MediaSource::Dump(const char* aPath)
}
#endif
void
MediaSource::GetMozDebugReaderData(nsAString& aString)
{
mDecoder->GetMozDebugReaderData(aString);
}
nsPIDOMWindow*
MediaSource::GetParentObject() const
{

View File

@ -114,6 +114,10 @@ public:
void Dump(const char* aPath);
#endif
// Returns a string describing the state of the MediaSource internal
// buffered data. Used for debugging purposes.
void GetMozDebugReaderData(nsAString& aString);
private:
// MediaSourceDecoder uses DurationChange to set the duration
// without hitting the checks in SetDuration.

View File

@ -102,6 +102,8 @@ interface HTMLMediaElement : HTMLElement {
// Mozilla extensions:
partial interface HTMLMediaElement {
[ChromeOnly]
readonly attribute MediaSource? mozMediaSourceObject;
attribute MediaStream? mozSrcObject;
attribute boolean mozPreservesPitch;
readonly attribute boolean mozAutoplayEnabled;

View File

@ -35,4 +35,6 @@ interface MediaSource : EventTarget {
[Throws]
void endOfStream(optional MediaSourceEndOfStreamError error);
static boolean isTypeSupported(DOMString type);
[ChromeOnly]
readonly attribute DOMString mozDebugReaderData;
};