author | Ehsan Akhgari <ehsan@mozilla.com> |
Mon, 05 Nov 2012 13:49:35 -0500 | |
changeset 112341 | bc191fe62b436ff9b265110ba16d09af7bb9c863 |
parent 112340 | c69822a9bd0fe015d1696be81c9e92a9203a477a |
child 112342 | 287f8cf1f1e163e07e6b0addbfa1e7258ceb8677 |
push id | 23812 |
push user | emorley@mozilla.com |
push date | Tue, 06 Nov 2012 14:01:34 +0000 |
treeherder | mozilla-central@f4aeed115e54 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mmcr8 |
bugs | 808374 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/media/webaudio/AudioBuffer.cpp +++ b/content/media/webaudio/AudioBuffer.cpp @@ -15,17 +15,16 @@ namespace mozilla { namespace dom { NS_IMPL_CYCLE_COLLECTION_CLASS(AudioBuffer) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AudioBuffer) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContext) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mChannels) NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER - NS_DROP_JS_OBJECTS(tmp, AudioBuffer); NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AudioBuffer) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mContext, AudioContext) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(AudioBuffer) @@ -44,31 +43,28 @@ NS_INTERFACE_MAP_END AudioBuffer::AudioBuffer(AudioContext* aContext, uint32_t aLength, uint32_t aSampleRate) : mContext(aContext), mLength(aLength), mSampleRate(aSampleRate) { SetIsDOMBinding(); + + NS_HOLD_JS_OBJECTS(this, AudioBuffer); } AudioBuffer::~AudioBuffer() { - // Drop the JS object reference if we're still holding to the channels - if (mChannels.Length()) { - NS_DROP_JS_OBJECTS(this, AudioBuffer); - } + NS_DROP_JS_OBJECTS(this, AudioBuffer); } bool AudioBuffer::InitializeBuffers(uint32_t aNumberOfChannels, JSContext* aJSContext) { - NS_HOLD_JS_OBJECTS(this, AudioBuffer); - if (!mChannels.SetCapacity(aNumberOfChannels)) { return false; } for (uint32_t i = 0; i < aNumberOfChannels; ++i) { JSObject* array = JS_NewFloat32Array(aJSContext, mLength); if (!array) { return false; }
--- a/content/media/webaudio/test/Makefile.in +++ b/content/media/webaudio/test/Makefile.in @@ -6,16 +6,17 @@ DEPTH := @DEPTH@ topsrcdir := @top_srcdir@ srcdir := @srcdir@ VPATH := @srcdir@ relativesrcdir := @relativesrcdir@ include $(DEPTH)/config/autoconf.mk MOCHITEST_FILES := \ + test_bug808374.html \ test_AudioBuffer.html \ test_AudioContext.html \ test_badConnect.html \ test_delayNode.html \ test_gainNode.html \ test_singleSourceDest.html \ $(NULL)
new file mode 100644 --- /dev/null +++ b/content/media/webaudio/test/test_bug808374.html @@ -0,0 +1,20 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Crashtest for bug 808374</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); +mozAudioContext().createBuffer(0, 0, 0); +ok(true, "The test should not crash during CC"); +SpecialPowers.clearUserPref("media.webaudio.enabled"); + +</script> +</pre> +</body> +</html>