Bug 866737 - Unregister PannerNodes when they're unlinked by the cycle collector; r=padenot

This commit is contained in:
Ehsan Akhgari 2013-04-29 14:06:40 -04:00
parent 581f025119
commit aa479f73fd
4 changed files with 59 additions and 0 deletions

View File

@ -15,6 +15,21 @@ namespace dom {
using namespace std;
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(PannerNode)
if (tmp->Context()) {
tmp->Context()->UnregisterPannerNode(tmp);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END_INHERITED(AudioNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PannerNode, AudioNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(PannerNode)
NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(PannerNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(PannerNode, AudioNode)
class PannerNodeEngine : public AudioNodeEngine
{
public:

View File

@ -38,6 +38,9 @@ public:
return true;
}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PannerNode, AudioNode)
PanningModelType PanningModel() const
{
return mPanningModel;

View File

@ -17,6 +17,7 @@ MOCHITEST_FILES := \
test_bug839753.html \
test_bug845960.html \
test_bug856771.html \
test_bug866737.html \
test_analyserNode.html \
test_AudioBuffer.html \
test_AudioContext.html \

View File

@ -0,0 +1,40 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for bug 866737</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);
var context = new AudioContext();
(function() {
var d = context.createDelay();
var panner = context.createPanner();
d.connect(panner);
var gain = context.createGain();
panner.connect(gain);
gain.connect(context.destination);
gain.disconnect(0);
})();
SpecialPowers.forceGC();
SpecialPowers.forceCC();
var gain = context.createGain();
gain.connect(context.destination);
gain.disconnect(0);
ok(true, "No crashes should happen!");
SpecialPowers.clearUserPref("media.webaudio.enabled");
</script>
</pre>
</body>
</html>