Bug 1006024 - Part 6: Replace AutoPushJSContext in AudioProcessingEvent::LazilyCreateBuffer. r=bholley

This commit is contained in:
Bob Owen 2014-05-09 19:43:48 +01:00
parent f9c6a2c9af
commit 57656ff550

View File

@ -6,6 +6,7 @@
#include "AudioProcessingEvent.h"
#include "mozilla/dom/AudioProcessingEventBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "AudioContext.h"
namespace mozilla {
@ -40,7 +41,15 @@ void
AudioProcessingEvent::LazilyCreateBuffer(nsRefPtr<AudioBuffer>& aBuffer,
uint32_t aNumberOfChannels)
{
AutoPushJSContext cx(mNode->Context()->GetJSContext());
// We need the global for the context so that we can enter its compartment.
JSObject* global = mNode->Context()->GetGlobalJSObject();
if (NS_WARN_IF(!global)) {
return;
}
AutoJSAPI jsapi;
JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, global);
aBuffer = new AudioBuffer(mNode->Context(), mNode->BufferSize(),
mNode->Context()->SampleRate());