Bug 866108 - Part 2: Do not assume that we can always get a script global from the context's window; r=padenot
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 27 Apr 2013 18:44:13 -0400
changeset 130204 217a16890daafb05cefac60399acb139806c18fa
parent 130203 bad7e68276958bbf74b27b91bc7b3e8f8dba41ec
child 130205 ab9fb5ce21d7e6f14ff7935380c5bdde2f950b69
push idunknown
push userunknown
push dateunknown
reviewerspadenot
bugs866108
milestone23.0a1
Bug 866108 - Part 2: Do not assume that we can always get a script global from the context's window; r=padenot
content/media/webaudio/AudioContext.cpp
--- a/content/media/webaudio/AudioContext.cpp
+++ b/content/media/webaudio/AudioContext.cpp
@@ -345,16 +345,19 @@ AudioContext::Resume()
 
 JSContext*
 AudioContext::GetJSContext() const
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIScriptGlobalObject> scriptGlobal =
     do_QueryInterface(GetParentObject());
+  if (!scriptGlobal) {
+    return nullptr;
+  }
   nsIScriptContext* scriptContext = scriptGlobal->GetContext();
   if (!scriptContext) {
     return nullptr;
   }
   return scriptContext->GetNativeContext();
 }
 
 }