Backed out changeset 477309013214
authorChris Double <chris.double@double.co.nz>
Wed, 01 Oct 2008 16:52:51 +1300
changeset 19964 602d44792dd941636201ecc5fa473d524f14c9e1
parent 19946 477309013214be0ce4a558fd1243b16e4b7d51cf
child 19965 da770a19d7924470b4ea194afa6e99dbddba39e7
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1b1pre
backs out477309013214be0ce4a558fd1243b16e4b7d51cf
Backed out changeset 477309013214
content/html/content/public/nsHTMLAudioElement.h
content/html/content/src/Makefile.in
content/html/content/src/nsHTMLAudioElement.cpp
content/media/video/test/Makefile.in
content/media/video/test/sound.ogg
content/media/video/test/test_audio1.html
content/media/video/test/test_audio2.html
layout/build/nsLayoutCID.h
layout/build/nsLayoutModule.cpp
--- a/content/html/content/public/nsHTMLAudioElement.h
+++ b/content/html/content/public/nsHTMLAudioElement.h
@@ -31,26 +31,24 @@
  * 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 "nsIDOMHTMLAudioElement.h"
-#include "nsIJSNativeInitializer.h"
 #include "nsHTMLMediaElement.h"
 #include "nsVideoDecoder.h"
 
 typedef PRUint16 nsMediaNetworkState;
 typedef PRUint16 nsMediaReadyState;
 
 class nsHTMLAudioElement : public nsHTMLMediaElement,
-                           public nsIDOMHTMLAudioElement,
-                           public nsIJSNativeInitializer
+                           public nsIDOMHTMLAudioElement
 {
 public:
   nsHTMLAudioElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
   virtual ~nsHTMLAudioElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
@@ -64,20 +62,16 @@ public:
   NS_FORWARD_NSIDOMHTMLELEMENT(nsHTMLMediaElement::)
 
   // nsIDOMHTMLMediaElement
   NS_FORWARD_NSIDOMHTMLMEDIAELEMENT(nsHTMLMediaElement::)
 
   // nsIDOMHTMLAudioElement
   NS_DECL_NSIDOMHTMLAUDIOELEMENT
 
-  // nsIJSNativeInitializer
-  NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
-                        JSObject* aObj, PRUint32 argc, jsval* argv);
-
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               PRBool aCompileEventHandlers);
   virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
                               PRBool aNullParent = PR_TRUE);
 protected:
   virtual nsresult InitializeDecoder(nsAString& aChosenMediaResource);
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -150,13 +150,12 @@ FORCE_STATIC_LIB = 1
 include $(topsrcdir)/config/rules.mk
 
 INCLUDES	+= \
 		-I$(srcdir)/../../../base/src \
 		-I$(srcdir)/../../../events/src \
 		-I$(srcdir)/../../../xbl/src \
 		-I$(srcdir)/../../../../layout/style \
 		-I$(srcdir)/../../../../layout/tables \
-		-I$(srcdir)/../../../../dom/src/base \
 		-I$(srcdir) \
 		$(NULL)
 
 DEFINES += -D_IMPL_NS_LAYOUT
--- a/content/html/content/src/nsHTMLAudioElement.cpp
+++ b/content/html/content/src/nsHTMLAudioElement.cpp
@@ -50,57 +50,36 @@
 #include "nsNodeInfoManager.h"
 #include "plbase64.h"
 #include "nsNetUtil.h"
 #include "prmem.h"
 #include "nsNetUtil.h"
 #include "nsXPCOMStrings.h"
 #include "prlock.h"
 #include "nsThreadUtils.h"
-#include "nsJSUtils.h"
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 
 #include "nsIRenderingContext.h"
 #include "nsITimer.h"
 
 #include "nsEventDispatcher.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMProgressEvent.h"
 #include "nsHTMLMediaError.h"
 
-nsGenericHTMLElement*
-NS_NewHTMLAudioElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
-{
-  /*
-   * nsHTMLAudioElement's will be created without a nsINodeInfo passed in
-   * if someone says "var audio = new Audio();" in JavaScript, in a case like
-   * that we request the nsINodeInfo from the document's nodeinfo list.
-   */
-  nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
-  if (!nodeInfo) {
-    nsCOMPtr<nsIDocument> doc =
-      do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
-    NS_ENSURE_TRUE(doc, nsnull);
-
-    nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::audio, nsnull,
-                                                   kNameSpaceID_None);
-    NS_ENSURE_TRUE(nodeInfo, nsnull);
-  }
-
-  return new nsHTMLAudioElement(nodeInfo);
-}
+NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Audio)
 
 NS_IMPL_ADDREF_INHERITED(nsHTMLAudioElement, nsHTMLMediaElement)
 NS_IMPL_RELEASE_INHERITED(nsHTMLAudioElement, nsHTMLMediaElement)
 
 NS_HTML_CONTENT_INTERFACE_TABLE_HEAD(nsHTMLAudioElement, nsHTMLMediaElement)
-NS_INTERFACE_TABLE_INHERITED2(nsHTMLAudioElement, nsIDOMHTMLAudioElement, nsIJSNativeInitializer)
+  NS_INTERFACE_TABLE_INHERITED1(nsHTMLAudioElement, nsIDOMHTMLAudioElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAudioElement)
 
 NS_IMPL_ELEMENT_CLONE(nsHTMLAudioElement)
 
 
 nsHTMLAudioElement::nsHTMLAudioElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
   : nsHTMLMediaElement(aNodeInfo, aFromParser)
 {
@@ -134,26 +113,8 @@ void nsHTMLAudioElement::UnbindFromTree(
 
 nsresult nsHTMLAudioElement::InitializeDecoder(nsAString& aChosenMediaResource)
 {
   if (mDecoder) 
     mDecoder->ElementAvailable(this);
 
   return nsHTMLMediaElement::InitializeDecoder(aChosenMediaResource);
 }
-
-NS_IMETHODIMP
-nsHTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
-                               JSObject *aObj, PRUint32 argc, jsval *argv)
-{
-  if (argc <= 0) {
-    // Nothing to do here if we don't get any arguments.
-    return NS_OK;
-  }
-
-  // The only (optional) argument is the url of the audio
-  JSString* jsstr = JS_ValueToString(aContext, argv[0]);
-  if (!jsstr)
-    return NS_ERROR_FAILURE;
-
-  nsDependentJSString str(jsstr);
-  return SetAttr(kNameSpaceID_None, nsGkAtoms::src, str, PR_TRUE);
-}
--- a/content/media/video/test/Makefile.in
+++ b/content/media/video/test/Makefile.in
@@ -38,27 +38,24 @@ DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/media/video/test
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_audio1.html \
-		test_audio2.html \
-                test_autoplay.html \
+_TEST_FILES = 	test_autoplay.html \
                 test_constants.html \
                 test_controls.html \
                 test_currentTime.html \
                 test_defaultPlaybackRate.html \
                 test_networkState.html \
                 test_paused.html \
                 test_playbackRate.html \
                 test_readyState.html \
                 test_start.html \
-                sound.ogg \
 #               test_bug448534.html \
                 320x240.ogg \
                 $(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
deleted file mode 100644
index edda4e9128435b0cc9ba500c9daca90e2be30acf..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/content/media/video/test/test_audio1.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Media test: Audio Constructor Test 1</title>
-  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-var timeout = setTimeout(function () {
-                          ok(false, "Test timed out");
-                          SimpleTest.finish();
-                          }, 30000); 
-var a1 = new Audio();
-a1.onload = function() {
-  ok(a1.networkState == a1.LOADED, "Audio onload");
-  clearTimeout(timeout);
-  SimpleTest.finish();
-}
-a1.src = 'sound.ogg';
-
-SimpleTest.waitForExplicitFinish();
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/content/media/video/test/test_audio2.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Media test: Audio Constructor Test 2</title>
-  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-var timeout = setTimeout(function () {
-                          ok(false, "Test timed out");
-                          SimpleTest.finish();
-                          }, 30000); 
-var a1 = new Audio('sound.ogg');
-a1.onload = function() {
-  ok(a1.networkState == a1.LOADED, "Audio onload");
-  clearTimeout(timeout);
-  SimpleTest.finish();
-}
-
-SimpleTest.waitForExplicitFinish();
-</script>
-</pre>
-</body>
-</html>
--- a/layout/build/nsLayoutCID.h
+++ b/layout/build/nsLayoutCID.h
@@ -220,17 +220,9 @@
 
 // {14632191-AC21-4BDF-83E7-2363AD17E838}
 #define NS_XULPOPUPMANAGER_CID \
 { 0x14632191, 0xac21, 0x4bdf, { 0x83, 0xe7, 0x23, 0x63, 0xad, 0x17, 0xe8, 0x38 } }
 
 // {93ad72a6-02cd-4716-9626-d47d5ec275ec}
 #define NS_DOMJSON_CID \
 { 0x93ad72a6, 0x02cd, 0x4716, { 0x96, 0x26, 0xd4, 0x7d, 0x5e, 0xc2, 0x75, 0xec } }
-
-#ifdef MOZ_MEDIA
-#define NS_HTMLAUDIOELEMENT_CID                   \
-{ /* 1d40026b-4c44-4f6f-b158-26bb5e9c65e9 */      \
- 0x1d40026b, 0x4c44, 0x4f6f,                      \
- {0xb1, 0x58, 0x26, 0xbb, 0x5e, 0x9c, 0x65, 0xe9}}
-#endif
-
 #endif /* nsLayoutCID_h__ */
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -218,21 +218,16 @@ class nsIDocumentLoaderFactory;
 #define PRODUCT_NAME "Gecko"
 
 #define NS_HTMLIMGELEMENT_CONTRACTID \
   "@mozilla.org/content/element/html;1?name=img"
 
 #define NS_HTMLOPTIONELEMENT_CONTRACTID \
   "@mozilla.org/content/element/html;1?name=option"
 
-#ifdef MOZ_MEDIA
-#define NS_HTMLAUDIOELEMENT_CONTRACTID \
-  "@mozilla.org/content/element/html;1?name=audio"
-#endif
-
 /* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */
 #define NS_PLUGINDOCLOADERFACTORY_CID \
 { 0x0ddf4df8, 0x4dbb, 0x4133, { 0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 } }
 
 #define NS_WINDOWCOMMANDTABLE_CID \
  { /* 0DE2FBFA-6B7F-11D7-BBBA-0003938A9D96 */        \
   0x0DE2FBFA, 0x6B7F, 0x11D7, {0xBB, 0xBA, 0x00, 0x03, 0x93, 0x8A, 0x9D, 0x96} }
 
@@ -492,17 +487,16 @@ MAKE_CTOR(CreateDOMSelection,           
 MAKE_CTOR(CreateSelection,                nsFrameSelection,            NS_NewSelection)
 MAKE_CTOR(CreateRange,                    nsIDOMRange,                 NS_NewRange)
 MAKE_CTOR(CreateRangeUtils,               nsIRangeUtils,               NS_NewRangeUtils)
 MAKE_CTOR(CreateContentIterator,          nsIContentIterator,          NS_NewContentIterator)
 MAKE_CTOR(CreatePreContentIterator,       nsIContentIterator,          NS_NewPreContentIterator)
 MAKE_CTOR(CreateSubtreeIterator,          nsIContentIterator,          NS_NewContentSubtreeIterator)
 // CreateHTMLImgElement, see below
 // CreateHTMLOptionElement, see below
-// CreateHTMLAudioElement, see below
 MAKE_CTOR(CreateTextEncoder,              nsIDocumentEncoder,          NS_NewTextEncoder)
 MAKE_CTOR(CreateHTMLCopyTextEncoder,      nsIDocumentEncoder,          NS_NewHTMLCopyTextEncoder)
 MAKE_CTOR(CreateXMLContentSerializer,     nsIContentSerializer,        NS_NewXMLContentSerializer)
 MAKE_CTOR(CreateHTMLContentSerializer,    nsIContentSerializer,        NS_NewHTMLContentSerializer)
 MAKE_CTOR(CreatePlainTextSerializer,      nsIContentSerializer,        NS_NewPlainTextSerializer)
 MAKE_CTOR(CreateHTMLFragmentSink,         nsIFragmentContentSink,      NS_NewHTMLFragmentContentSink)
 MAKE_CTOR(CreateHTMLFragmentSink2,        nsIFragmentContentSink,      NS_NewHTMLFragmentContentSink2)
 MAKE_CTOR(CreateHTMLParanoidFragmentSink, nsIFragmentContentSink,      NS_NewHTMLParanoidFragmentSink)
@@ -669,63 +663,16 @@ UnregisterHTMLOptionElement(nsIComponent
                             nsIFile* aPath,
                             const char* aRegistryLocation,
                             const nsModuleComponentInfo* aInfo)
 {
   // XXX remove category entry
   return NS_OK;
 }
 
-#ifdef MOZ_MEDIA
-static NS_IMETHODIMP
-CreateHTMLAudioElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
-{
-  *aResult = nsnull;
-  if (aOuter)
-    return NS_ERROR_NO_AGGREGATION;
-  // Note! NS_NewHTMLAudioElement is special cased to handle a null nodeinfo
-  nsCOMPtr<nsIContent> inst(NS_NewHTMLAudioElement(nsnull));
-  return inst ? inst->QueryInterface(aIID, aResult) : NS_ERROR_OUT_OF_MEMORY;
-}
-
-static NS_IMETHODIMP
-RegisterHTMLAudioElement(nsIComponentManager *aCompMgr,
-                         nsIFile* aPath,
-                         const char* aRegistryLocation,
-                         const char* aComponentType,
-                         const nsModuleComponentInfo* aInfo)
-{
-  nsCOMPtr<nsICategoryManager> catman =
-    do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
-
-  if (!catman)
-    return NS_ERROR_FAILURE;
-
-  nsXPIDLCString previous;
-  nsresult rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
-                                         "Audio", NS_HTMLAUDIOELEMENT_CONTRACTID,
-                                         PR_TRUE, PR_TRUE, getter_Copies(previous));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
-                                  "Audio", "HTMLAudioElement",
-                                  PR_TRUE, PR_TRUE, getter_Copies(previous));
-}
-
-static NS_IMETHODIMP
-UnregisterHTMLAudioElement(nsIComponentManager* aCompMgr,
-                           nsIFile* aPath,
-                           const char* aRegistryLocation,
-                           const nsModuleComponentInfo* aInfo)
-{
-  // XXX remove category entry
-  return NS_OK;
-}
-#endif
-
 static NS_METHOD
 RegisterDataDocumentContentPolicy(nsIComponentManager *aCompMgr,
                                   nsIFile* aPath,
                                   const char* aRegistryLocation,
                                   const char* aComponentType,
                                   const nsModuleComponentInfo* aInfo)
 {
   nsresult rv;
@@ -1048,40 +995,31 @@ static const nsModuleComponentInfo gComp
     nsnull,
     nsCSSOMFactoryConstructor },
 
   { "Inspector CSS Utils",
     NS_INSPECTORCSSUTILS_CID,
     nsnull,
     nsInspectorCSSUtilsConstructor },
 
-  // Needed to support "new Option;", "new Image;" and "new Audio;" in JavaScript
+  // Needed to support "new Option;" and "new Image;" in JavaScript
   { "HTML img element",
     NS_HTMLIMAGEELEMENT_CID,
     NS_HTMLIMGELEMENT_CONTRACTID,
     CreateHTMLImgElement,
     RegisterHTMLImgElement, 
     UnregisterHTMLImgElement },
 
   { "HTML option element",
     NS_HTMLOPTIONELEMENT_CID,
     NS_HTMLOPTIONELEMENT_CONTRACTID,
     CreateHTMLOptionElement,
     RegisterHTMLOptionElement,
     UnregisterHTMLOptionElement },
 
-#ifdef MOZ_MEDIA
-  { "HTML audio element",
-    NS_HTMLAUDIOELEMENT_CID,
-    NS_HTMLAUDIOELEMENT_CONTRACTID,
-    CreateHTMLAudioElement,
-    RegisterHTMLAudioElement, 
-    UnregisterHTMLAudioElement },
-#endif
-
 #ifdef MOZ_ENABLE_CANVAS
   { "Canvas 2D Rendering Context",
     NS_CANVASRENDERINGCONTEXT2D_CID,
     "@mozilla.org/content/canvas-rendering-context;1?id=2d",
     CreateCanvasRenderingContext2D },
 #endif
 
   { "XML document encoder",