Bug 462957 - DOM implementation of HTMLMediaElement.buffered. r=roc a=blocking2.0
authorChris Pearce <chris@pearce.org.nz>
Thu, 05 Aug 2010 19:40:35 +1200
changeset 48902 73b7dc45e26a6922bae67c166df3566f38977ee7
parent 48901 e29fc477ab4d1ae6ec74e20b527b321a10736aed
child 48903 225b2a943f2cda7aaa72e7398f4fc0033f579515
push idunknown
push userunknown
push dateunknown
reviewersroc, blocking2
bugs462957
milestone2.0b4pre
Bug 462957 - DOM implementation of HTMLMediaElement.buffered. r=roc a=blocking2.0
content/html/content/src/Makefile.in
content/html/content/src/nsHTMLMediaElement.cpp
content/html/content/src/nsHTMLTimeRanges.cpp
content/html/content/src/nsHTMLTimeRanges.h
content/media/nsBuiltinDecoder.h
content/media/nsBuiltinDecoderReader.h
content/media/nsBuiltinDecoderStateMachine.h
content/media/nsMediaDecoder.h
content/media/ogg/nsOggReader.cpp
content/media/ogg/nsOggReader.h
content/media/wave/nsWaveDecoder.cpp
content/media/wave/nsWaveDecoder.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/interfaces/html/nsIDOMHTMLMediaElement.idl
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -105,16 +105,17 @@ CPPSRCS		= \
 		nsHTMLStyleElement.cpp \
 		nsHTMLTableElement.cpp \
 		nsHTMLTableCaptionElement.cpp \
 		nsHTMLTableCellElement.cpp \
 		nsHTMLTableColElement.cpp \
 		nsHTMLTableRowElement.cpp \
 		nsHTMLTableSectionElement.cpp \
 		nsHTMLTextAreaElement.cpp \
+		nsHTMLTimeRanges.cpp \
 		nsHTMLTitleElement.cpp \
 		$(NULL)
 
 ifdef MOZ_MEDIA
 CPPSRCS		+= \
 		nsHTMLAudioElement.cpp \
 		nsHTMLMediaElement.cpp \
 		nsHTMLMediaError.cpp \
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -34,16 +34,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMHTMLMediaElement.h"
 #include "nsIDOMHTMLSourceElement.h"
 #include "nsHTMLMediaElement.h"
+#include "nsHTMLTimeRanges.h"
 #include "nsGenericHTMLElement.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "nsSize.h"
 #include "nsIFrame.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
@@ -2208,8 +2209,18 @@ nsHTMLMediaElement::CopyInnerTo(nsGeneri
         nsLayoutUtils::SurfaceFromElement(elem,
                                           nsLayoutUtils::SFE_WANT_NEW_SURFACE);
       dest->mPrintSurface = res.mSurface;
       dest->mMediaSize = nsIntSize(res.mSize.width, res.mSize.height);
     }
   }
   return rv;
 }
+
+nsresult nsHTMLMediaElement::GetBuffered(nsIDOMHTMLTimeRanges** aBuffered)
+{
+  nsHTMLTimeRanges* ranges = new nsHTMLTimeRanges();
+  NS_ADDREF(*aBuffered = ranges);
+  if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA && mDecoder) {
+    return mDecoder->GetBuffered(ranges);
+  }
+  return NS_OK;
+}
new file mode 100644
--- /dev/null
+++ b/content/html/content/src/nsHTMLTimeRanges.cpp
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla code.
+ *
+ * The Initial Developer of the Original Code is the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Chris Pearce <chris@pearce.org.nz>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsHTMLTimeRanges.h"
+#include "nsDOMError.h"
+#include "nsContentUtils.h"
+
+NS_IMPL_ADDREF(nsHTMLTimeRanges)
+NS_IMPL_RELEASE(nsHTMLTimeRanges)
+
+DOMCI_DATA(HTMLTimeRanges, nsHTMLTimeRanges)
+
+NS_INTERFACE_MAP_BEGIN(nsHTMLTimeRanges)
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLTimeRanges)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLTimeRanges)
+NS_INTERFACE_MAP_END
+
+NS_IMETHODIMP
+nsHTMLTimeRanges::GetLength(PRUint32* aLength) {
+  *aLength = mRanges.Length();
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLTimeRanges::Start(PRUint32 aIndex, float* aTime) {
+  if (aIndex > mRanges.Length())
+    return NS_ERROR_DOM_INDEX_SIZE_ERR;
+  *aTime = mRanges[aIndex].mStart;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLTimeRanges::End(PRUint32 aIndex, float* aTime) {
+  if (aIndex > mRanges.Length())
+    return NS_ERROR_DOM_INDEX_SIZE_ERR;
+  *aTime = mRanges[aIndex].mEnd;
+  return NS_OK;
+}
+
+void
+nsHTMLTimeRanges::Add(float aStart, float aEnd) {
+  mRanges.AppendElement(TimeRange(aStart,aEnd));
+}
new file mode 100644
--- /dev/null
+++ b/content/html/content/src/nsHTMLTimeRanges.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla code.
+ *
+ * The Initial Developer of the Original Code is the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Chris Pearce <chris@pearce.org.nz>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsIDOMHTMLTimeRanges.h"
+#include "nsISupports.h"
+#include "nsTArray.h"
+
+// Implements media TimeRanges:
+// http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#timeranges
+class nsHTMLTimeRanges : public nsIDOMHTMLTimeRanges {
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIDOMHTMLTIMERANGES
+
+  void Add(float aStart, float aEnd);
+
+private:
+
+  struct TimeRange {
+    TimeRange(float aStart, float aEnd)
+      : mStart(aStart),
+        mEnd(aEnd) {}
+    float mStart;
+    float mEnd;
+  };
+
+  nsAutoTArray<TimeRange,4> mRanges;
+};
--- a/content/media/nsBuiltinDecoder.h
+++ b/content/media/nsBuiltinDecoder.h
@@ -289,16 +289,18 @@ public:
 
   // Update the playback position. This can result in a timeupdate event
   // and an invalidate of the frame being dispatched asynchronously if
   // there is no such event currently queued.
   // Only called on the decoder thread. Must be called with
   // the decode monitor held.
   virtual void UpdatePlaybackPosition(PRInt64 aTime) = 0;
 
+  virtual nsresult GetBuffered(nsHTMLTimeRanges* aBuffered) = 0;
+  
   // Causes the state machine to switch to buffering state, and to
   // immediately stop playback and buffer downloaded data. Must be called
   // with the decode monitor held. Called on the state machine thread and
   // the main thread.
   virtual void StartBuffering() = 0;
 };
 
 class nsBuiltinDecoder : public nsMediaDecoder
@@ -421,16 +423,22 @@ class nsBuiltinDecoder : public nsMediaD
   }
 
   // Returns the monitor for other threads to synchronise access to
   // state.
   Monitor& GetMonitor() { 
     return mMonitor; 
   }
 
+  // Constructs the time ranges representing what segments of the media
+  // are buffered and playable.
+  virtual nsresult GetBuffered(nsHTMLTimeRanges* aBuffered) {
+    return mDecoderStateMachine->GetBuffered(aBuffered);
+  }
+
  public:
   // Return the current state. Can be called on any thread. If called from
   // a non-main thread, the decoder monitor must be held.
   PlayState GetState() {
     return mPlayState;
   }
 
   // Stop updating the bytes downloaded for progress notifications. Called
--- a/content/media/nsBuiltinDecoderReader.h
+++ b/content/media/nsBuiltinDecoderReader.h
@@ -447,16 +447,19 @@ public:
   }
 
   // Queue of audio samples. This queue is threadsafe.
   MediaQueue<SoundData> mAudioQueue;
 
   // Queue of video samples. This queue is threadsafe.
   MediaQueue<VideoData> mVideoQueue;
 
+  // This is called on the main thread, and it must not block.
+  virtual nsresult GetBuffered(nsHTMLTimeRanges* aBuffered, PRInt64 aStartTime) = 0;
+
 protected:
 
   // Reader decode function. Matches DecodeVideoFrame() and
   // DecodeAudioData().
   typedef PRBool (nsBuiltinDecoderReader::*DecodeFn)();
 
   // Calls aDecodeFn on *this until aQueue has a sample, whereupon
   // we return the first sample.
--- a/content/media/nsBuiltinDecoderStateMachine.h
+++ b/content/media/nsBuiltinDecoderStateMachine.h
@@ -229,16 +229,20 @@ public:
   nsBuiltinDecoder* mDecoder;
 
   // The decoder monitor must be obtained before modifying this state.
   // NotifyAll on the monitor must be called when the state is changed by
   // the main thread so the decoder thread can wake up.
   // Accessed on state machine, audio, main, and AV thread. 
   State mState;
 
+  nsresult GetBuffered(nsHTMLTimeRanges* aBuffered) {
+    return mReader->GetBuffered(aBuffered, mStartTime);
+  }
+
 protected:
 
   // Returns PR_TRUE when there's decoded audio waiting to play.
   // The decoder monitor must be held.
   PRBool HasFutureAudio() const;
 
   // Waits on the decoder Monitor for aMs. If the decoder monitor is awoken
   // by a Notify() call, we'll continue waiting, unless we've moved into
--- a/content/media/nsMediaDecoder.h
+++ b/content/media/nsMediaDecoder.h
@@ -46,16 +46,17 @@
 #include "gfxContext.h"
 #include "gfxRect.h"
 #include "nsITimer.h"
 #include "ImageLayers.h"
 
 class nsHTMLMediaElement;
 class nsMediaStream;
 class nsIStreamListener;
+class nsHTMLTimeRanges;
 
 // All methods of nsMediaDecoder must be called from the main thread only
 // with the exception of GetImageContainer, SetVideoData and GetStatistics,
 // which can be called from any thread.
 class nsMediaDecoder : public nsIObserver
 {
 public:
   typedef mozilla::TimeStamp TimeStamp;
@@ -231,16 +232,20 @@ public:
   ImageContainer* GetImageContainer() { return mImageContainer; }
 
   // Set the video width, height, pixel aspect ratio, and current image.
   // Ownership of the image is transferred to the decoder.
   void SetVideoData(const gfxIntSize& aSize,
                     float aPixelAspectRatio,
                     Image* aImage);
 
+  // Constructs the time ranges representing what segments of the media
+  // are buffered and playable.
+  virtual nsresult GetBuffered(nsHTMLTimeRanges* aBuffered) = 0;
+
   // Returns PR_TRUE if we can play the entire media through without stopping
   // to buffer, given the current download and playback rates.
   PRBool CanPlayThrough();
 
 protected:
 
   // Start timer to update download progress information.
   nsresult StartProgress();
--- a/content/media/ogg/nsOggReader.cpp
+++ b/content/media/ogg/nsOggReader.cpp
@@ -1382,9 +1382,12 @@ nsresult nsOggReader::SeekBisection(PRIn
     NS_ASSERTION(endTime >= seekTarget, "End must be after seek target");
   }
 
   SEEK_LOG(PR_LOG_DEBUG, ("Seek complete in %d bisections.", hops));
 
   return NS_OK;
 }
 
-
+nsresult nsOggReader::GetBuffered(nsHTMLTimeRanges* aBuffered)
+{
+  return NS_OK;
+}
--- a/content/media/ogg/nsOggReader.h
+++ b/content/media/ogg/nsOggReader.h
@@ -41,16 +41,17 @@
 
 #include <ogg/ogg.h>
 #include <theora/theoradec.h>
 #include <vorbis/codec.h>
 #include "nsBuiltinDecoderReader.h"
 #include "nsOggCodecState.h"
 
 class nsMediaDecoder;
+class nsHTMLTimeRanges;
 
 class nsOggReader : public nsBuiltinDecoderReader
 {
 public:
   nsOggReader(nsBuiltinDecoder* aDecoder);
   ~nsOggReader();
 
   virtual nsresult Init();
@@ -76,16 +77,19 @@ public:
   {
     mozilla::MonitorAutoEnter mon(mMonitor);
     return mTheoraState != 0 && mTheoraState->mActive;
   }
 
   virtual nsresult ReadMetadata();
   virtual nsresult Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime);
 
+  // This is called on the main thread, and it must not block.
+  virtual nsresult GetBuffered(nsHTMLTimeRanges* aBuffered);
+
 private:
   // Decodes one packet of Vorbis data, storing the resulting chunks of
   // PCM samples in aChunks.
   nsresult DecodeVorbis(nsTArray<SoundData*>& aChunks,
                         ogg_packet* aPacket);
 
   // May return NS_ERROR_OUT_OF_MEMORY.
   nsresult DecodeTheora(nsTArray<VideoData*>& aFrames,
--- a/content/media/wave/nsWaveDecoder.cpp
+++ b/content/media/wave/nsWaveDecoder.cpp
@@ -44,16 +44,17 @@
 #include "nsIObserver.h"
 #include "nsISeekableStream.h"
 #include "nsAudioStream.h"
 #include "nsAutoLock.h"
 #include "nsHTMLMediaElement.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "nsWaveDecoder.h"
+#include "nsHTMLTimeRanges.h"
 
 using mozilla::TimeDuration;
 using mozilla::TimeStamp;
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gWaveDecoderLog;
 #define LOG(type, msg) PR_LOG(gWaveDecoderLog, type, msg)
 #else
@@ -1648,8 +1649,14 @@ nsWaveDecoder::Resume(PRBool aForceBuffe
 
 void 
 nsWaveDecoder::MoveLoadsToBackground()
 {
   if (mStream) {
     mStream->MoveLoadsToBackground();
   }
 }
+
+nsresult
+nsWaveDecoder::GetBuffered(nsHTMLTimeRanges* aBuffered)
+{
+  return NS_OK;
+}
--- a/content/media/wave/nsWaveDecoder.h
+++ b/content/media/wave/nsWaveDecoder.h
@@ -129,16 +129,17 @@
   the audio backend (sydneyaudio via nsAudioStream) currently supports.  The
   supported sample rate is artificially limited to arbitrarily selected sane
   values.  Support for additional channels (and other new features) would
   require extending nsWaveDecoder to support parsing the newer
   WAVE_FORMAT_EXTENSIBLE chunk format.
  */
 
 class nsWaveStateMachine;
+class nsHTMLTimeRanges;
 
 class nsWaveDecoder : public nsMediaDecoder
 {
   friend class nsWaveStateMachine;
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
@@ -231,16 +232,20 @@ class nsWaveDecoder : public nsMediaDeco
   void UpdateReadyStateForData();
 
   // Tells mStream to put all loads in the background.
   virtual void MoveLoadsToBackground();
 
   // Called asynchronously to shut down the decoder
   void Stop();
 
+  // Constructs the time ranges representing what segments of the media
+  // are buffered and playable.
+  virtual nsresult GetBuffered(nsHTMLTimeRanges* aBuffered);
+
 private:
   // Notifies the element that seeking has started.
   void SeekingStarted();
 
   // Notifies the element that seeking has completed.
   void SeekingStopped();
 
   // Notifies the element that metadata loading has completed.  Only fired
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -300,16 +300,17 @@
 #include "nsIDOMHTMLTableElement.h"
 #include "nsIDOMHTMLTableRowElement.h"
 #include "nsIDOMHTMLTableSectionElem.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsIDOMNSHTMLTextAreaElement.h"
 #include "nsIDOMHTMLTitleElement.h"
 #include "nsIDOMHTMLUListElement.h"
 #include "nsIDOMHTMLMediaError.h"
+#include "nsIDOMHTMLTimeRanges.h"
 #include "nsIDOMHTMLSourceElement.h"
 #include "nsIDOMHTMLVideoElement.h"
 #include "nsIDOMHTMLAudioElement.h"
 #include "nsIDOMProgressEvent.h"
 #include "nsIDOMNSUIEvent.h"
 #include "nsIDOMNSCSS2Properties.h"
 #include "nsIDOMCSSCharsetRule.h"
 #include "nsIDOMCSSImportRule.h"
@@ -1350,16 +1351,18 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(HTMLVideoElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(HTMLSourceElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(HTMLMediaError, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(HTMLAudioElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
+  NS_DEFINE_CLASSINFO_DATA(HTMLTimeRanges, nsDOMGenericSH,
+                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
   NS_DEFINE_CLASSINFO_DATA(ProgressEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(XMLHttpRequestUpload, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
 
@@ -3840,16 +3843,21 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(HTMLMediaError, nsIDOMHTMLMediaError)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLMediaError)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(HTMLAudioElement, nsIDOMHTMLAudioElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLAudioElement)
     DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
+
+  DOM_CLASSINFO_MAP_BEGIN(HTMLTimeRanges, nsIDOMHTMLTimeRanges)
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLTimeRanges)
+    DOM_CLASSINFO_EVENT_MAP_ENTRIES
+  DOM_CLASSINFO_MAP_END  
 #endif
 
   DOM_CLASSINFO_MAP_BEGIN(ProgressEvent, nsIDOMProgressEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMProgressEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(XMLHttpRequestUpload, nsIXMLHttpRequestUpload)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -428,16 +428,17 @@ DOMCI_CLASS(CSSFontFaceRule)
 DOMCI_CLASS(CSSFontFaceStyleDecl)
 
 #if defined(MOZ_MEDIA)
 // WhatWG Video Element
 DOMCI_CLASS(HTMLVideoElement)
 DOMCI_CLASS(HTMLSourceElement)
 DOMCI_CLASS(HTMLMediaError)
 DOMCI_CLASS(HTMLAudioElement)
+DOMCI_CLASS(HTMLTimeRanges)
 #endif
 
 DOMCI_CLASS(ProgressEvent)
 
 DOMCI_CLASS(XMLHttpRequestUpload)
 
 // DOM Traversal NodeIterator class
 DOMCI_CLASS(NodeIterator)
--- a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
@@ -33,16 +33,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMHTMLElement.idl"
 #include "nsIDOMHTMLMediaError.idl"
+#include "nsIDOMHTMLTimeRanges.idl"
 
 /**
  * The nsIDOMHTMLMediaElement interface is an interface to be implemented by the HTML
  * <audio> and <video> elements.
  *
  * For more information on this interface, please see
  * http://www.whatwg.org/specs/web-apps/current-work/#htmlmediaelement
  *
@@ -51,31 +52,32 @@
 
 // undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
 %{C++
 #ifdef GetCurrentTime
 #undef GetCurrentTime
 #endif
 %}
 
-[scriptable, uuid(505b523e-4a27-4151-b0eb-750b7258760e)]
+[scriptable, uuid(b6c9f51d-237c-44d1-842d-996f4d62c843)]
 interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement
 {
   // error state
   readonly attribute nsIDOMHTMLMediaError error;
 
   // network state
            attribute DOMString src;
   readonly attribute DOMString currentSrc;
   const unsigned short NETWORK_EMPTY = 0;
   const unsigned short NETWORK_IDLE = 1;
   const unsigned short NETWORK_LOADING = 2;
   const unsigned short NETWORK_LOADED = 3;
   const unsigned short NETWORK_NO_SOURCE = 4;
   readonly attribute unsigned short networkState;
+  readonly attribute nsIDOMHTMLTimeRanges buffered;
   void load();
   DOMString canPlayType(in DOMString type);
 
   // ready state
   const unsigned short HAVE_NOTHING = 0;
   const unsigned short HAVE_METADATA = 1;
   const unsigned short HAVE_CURRENT_DATA = 2;
   const unsigned short HAVE_FUTURE_DATA = 3;