Bug 867203 - Part 1: Unregister AudioBufferSourceNodes from PannerNodes when they die; r=padenot

--HG--
extra : rebase_source : 3c580a0feba39d01779a91e6bd10a10d98cb7114
This commit is contained in:
Ehsan Akhgari 2013-04-30 19:20:55 -04:00
parent 362a875bea
commit c9ce04d576
5 changed files with 44 additions and 0 deletions

View File

@ -21,6 +21,11 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioBufferSourceNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBuffer)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPlaybackRate)
if (tmp->Context()) {
// AudioNode's Unlink implementation disconnects us from the graph
// too, but we need to do this right here to make sure that
// UnregisterAudioBufferSourceNode can properly untangle us from
// the possibly connected PannerNodes.
tmp->DisconnectFromGraph();
tmp->Context()->UnregisterAudioBufferSourceNode(tmp);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(AudioNode)

View File

@ -244,6 +244,7 @@ void
AudioContext::UnregisterAudioBufferSourceNode(AudioBufferSourceNode* aNode)
{
mAudioBufferSourceNodes.RemoveEntry(aNode);
UpdatePannerSource();
}
void

View File

@ -173,6 +173,7 @@ public:
void RemoveOutputParam(AudioParam* aParam);
private:
friend class AudioBufferSourceNode;
// This could possibly delete 'this'.
void DisconnectFromGraph();

View File

@ -20,6 +20,7 @@ MOCHITEST_FILES := \
test_bug866570.html \
test_bug866737.html \
test_bug867089.html \
test_bug867203.html \
test_analyserNode.html \
test_AudioBuffer.html \
test_AudioContext.html \

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Crashtest for bug 867203</title>
<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">
SpecialPowers.setBoolPref("media.webaudio.enabled", true);
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var ctx = new AudioContext();
var panner1 = ctx.createPanner();
panner1.setVelocity(1, 1, 1);
ctx.listener.setVelocity(1, 1, 1);
(function() {
ctx.createBufferSource().connect(panner1);
})();
SpecialPowers.forceGC();
SpecialPowers.forceCC();
ctx.createPanner();
ok(true, "We did not crash.");
SpecialPowers.clearUserPref("media.webaudio.enabled");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>