Bug 1361475 - Remove proprietary constructor on AudioContext. r?baku draft
authorPaul Adenot <paul@paul.cx>
Thu, 04 May 2017 13:43:14 +0200
changeset 572622 80fef2d8bc5fa79e55334c5d786fdf1f44a66493
parent 571941 d7e40bb852ea047a0e5f530bcdc04d29a1765001
child 627071 0ee721907929cd9f2afe55513e8f0cc5cebbceb4
push id57126
push userpaul@paul.cx
push dateThu, 04 May 2017 12:11:30 +0000
reviewersbaku
bugs1361475
milestone55.0a1
Bug 1361475 - Remove proprietary constructor on AudioContext. r?baku This was used only for B2G, was proprietary, and is causing issues, because `AudioContext` can now have a parameter that is a property bag, per spec (although we haven't implemented it at the moment). MozReview-Commit-ID: 6LOlNp0cbfV
dom/media/test/crashtests/1228484.html
dom/media/test/crashtests/crashtests.list
dom/media/webaudio/AudioContext.cpp
dom/media/webaudio/AudioContext.h
dom/webidl/AudioContext.webidl
deleted file mode 100644
--- a/dom/media/test/crashtests/1228484.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script>
-
-var htmlAudio = new Audio(URL.createObjectURL(new window.MediaSource()));
-
-(new window.AudioContext("ringer")).createMediaElementSource(htmlAudio);
-(new window.AudioContext("alarm")).createMediaElementSource(htmlAudio);
-
-</script>
-</head>
-</html>
--- a/dom/media/test/crashtests/crashtests.list
+++ b/dom/media/test/crashtests/crashtests.list
@@ -76,18 +76,16 @@ load 1041466.html
 load 1045650.html
 load 1080986.html
 load 1122218.html
 load 1127188.html
 load 1157994.html
 load 1158427.html
 load 1185176.html
 load 1185192.html
-load 1223670.html
-load 1228484.html
 load 1304948.html
 load 1319486.html
 load 1291702.html
 load disconnect-wrong-destination.html
 load analyser-channels-1.html
 load audiocontext-double-suspend.html
 load buffer-source-duration-1.html
 load buffer-source-ended-1.html
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -193,33 +193,25 @@ AudioContext::WrapObject(JSContext* aCx,
     return AudioContextBinding::Wrap(aCx, this, aGivenProto);
   }
 }
 
 /* static */ already_AddRefed<AudioContext>
 AudioContext::Constructor(const GlobalObject& aGlobal,
                           ErrorResult& aRv)
 {
-  return AudioContext::Constructor(aGlobal,
-                                   AudioChannelService::GetDefaultAudioChannel(),
-                                   aRv);
-}
-
-/* static */ already_AddRefed<AudioContext>
-AudioContext::Constructor(const GlobalObject& aGlobal,
-                          AudioChannel aChannel,
-                          ErrorResult& aRv)
-{
   nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
   if (!window) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
-  RefPtr<AudioContext> object = new AudioContext(window, false, aChannel);
+  RefPtr<AudioContext> object =
+    new AudioContext(window, false,
+                     AudioChannelService::GetDefaultAudioChannel());
   aRv = object->Init();
   if (NS_WARN_IF(aRv.Failed())) {
      return nullptr;
   }
 
   RegisterWeakMemoryReporter(object);
 
   return object.forget();
--- a/dom/media/webaudio/AudioContext.h
+++ b/dom/media/webaudio/AudioContext.h
@@ -149,22 +149,16 @@ public:
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   using DOMEventTargetHelper::DispatchTrustedEvent;
 
   // Constructor for regular AudioContext
   static already_AddRefed<AudioContext>
   Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
 
-  // Constructor for regular AudioContext. A default audio channel is needed.
-  static already_AddRefed<AudioContext>
-  Constructor(const GlobalObject& aGlobal,
-              AudioChannel aChannel,
-              ErrorResult& aRv);
-
   // Constructor for offline AudioContext
   static already_AddRefed<AudioContext>
   Constructor(const GlobalObject& aGlobal,
               uint32_t aNumberOfChannels,
               uint32_t aLength,
               float aSampleRate,
               ErrorResult& aRv);
 
--- a/dom/webidl/AudioContext.webidl
+++ b/dom/webidl/AudioContext.webidl
@@ -6,17 +6,16 @@
  * The origin of this IDL file is
  * https://webaudio.github.io/web-audio-api/
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
 [Constructor,
- Constructor(AudioChannel audioChannelType),
  Pref="dom.webaudio.enabled"]
 interface AudioContext : BaseAudioContext {
 
     // Bug 1324545: readonly        attribute double outputLatency;
     // Bug 1324545: AudioTimestamp                  getOutputTimestamp ();
 
     [Throws]
     Promise<void> suspend();
@@ -28,9 +27,9 @@ interface AudioContext : BaseAudioContex
 
     [NewObject, Throws, UnsafeInPrerendering]
     MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
 
     // Bug 1324548: MediaStreamTrackAudioSourceNode createMediaStreamTrackSource (AudioMediaStreamTrack mediaStreamTrack);
 
     [NewObject, Throws]
     MediaStreamAudioDestinationNode createMediaStreamDestination();
-};
\ No newline at end of file
+};