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 id24605
push userkwierso@gmail.com
push dateMon, 29 Apr 2013 21:47:00 +0000
treeherdermozilla-central@dd0c611a0a27 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs866108
milestone23.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
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();
 }
 
 }