diff --git a/content/media/webaudio/AudioContext.cpp b/content/media/webaudio/AudioContext.cpp index 44abf6d05dea..de380dedb12a 100644 --- a/content/media/webaudio/AudioContext.cpp +++ b/content/media/webaudio/AudioContext.cpp @@ -401,6 +401,9 @@ void AudioContext::UnregisterPannerNode(PannerNode* aNode) { mPannerNodes.RemoveEntry(aNode); + if (mListener) { + mListener->UnregisterPannerNode(aNode); + } } void diff --git a/content/media/webaudio/AudioListener.cpp b/content/media/webaudio/AudioListener.cpp index e20bbdc13c27..8c3c91638527 100644 --- a/content/media/webaudio/AudioListener.cpp +++ b/content/media/webaudio/AudioListener.cpp @@ -52,6 +52,11 @@ AudioListener::RegisterPannerNode(PannerNode* aPannerNode) UpdatePannersVelocity(); } +void AudioListener::UnregisterPannerNode(PannerNode* aPannerNode) +{ + mPanners.RemoveElement(aPannerNode); +} + void AudioListener::SendDoubleParameterToStream(uint32_t aIndex, double aValue) { diff --git a/content/media/webaudio/AudioListener.h b/content/media/webaudio/AudioListener.h index e2e83d852e83..bb38108cca53 100644 --- a/content/media/webaudio/AudioListener.h +++ b/content/media/webaudio/AudioListener.h @@ -127,6 +127,7 @@ public: } void RegisterPannerNode(PannerNode* aPannerNode); + void UnregisterPannerNode(PannerNode* aPannerNode); private: void SendDoubleParameterToStream(uint32_t aIndex, double aValue); diff --git a/content/media/webaudio/PannerNode.cpp b/content/media/webaudio/PannerNode.cpp index 89036112024a..9ad2a1422e79 100644 --- a/content/media/webaudio/PannerNode.cpp +++ b/content/media/webaudio/PannerNode.cpp @@ -212,6 +212,14 @@ PannerNode::WrapObject(JSContext* aCx, JS::Handle aScope) return PannerNodeBinding::Wrap(aCx, aScope, this); } +void PannerNode::DestroyMediaStream() +{ + if (Context()) { + Context()->UnregisterPannerNode(this); + } + AudioNode::DestroyMediaStream(); +} + // Those three functions are described in the spec. float PannerNodeEngine::LinearGainFunction(float aDistance) diff --git a/content/media/webaudio/PannerNode.h b/content/media/webaudio/PannerNode.h index d0b0839a319b..065d1d2d1d9b 100644 --- a/content/media/webaudio/PannerNode.h +++ b/content/media/webaudio/PannerNode.h @@ -31,9 +31,12 @@ public: explicit PannerNode(AudioContext* aContext); virtual ~PannerNode(); + virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; + virtual void DestroyMediaStream() MOZ_OVERRIDE; + NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PannerNode, AudioNode) diff --git a/content/media/webaudio/test/Makefile.in b/content/media/webaudio/test/Makefile.in index c4cfe976c7c2..7a45ccdf0dc1 100644 --- a/content/media/webaudio/test/Makefile.in +++ b/content/media/webaudio/test/Makefile.in @@ -27,6 +27,7 @@ MOCHITEST_FILES := \ test_bug867203.html \ test_bug875221.html \ test_bug875402.html \ + test_bug894150.html \ test_analyserNode.html \ test_AudioBuffer.html \ test_AudioContext.html \ diff --git a/content/media/webaudio/test/test_bug894150.html b/content/media/webaudio/test/test_bug894150.html new file mode 100644 index 000000000000..676826d0d003 --- /dev/null +++ b/content/media/webaudio/test/test_bug894150.html @@ -0,0 +1,21 @@ + + + + Test whether we can create an AudioContext interface + + + + + +