Bug 1209461 - Remove compilation warnings in nsFrameMessageManager, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 29 Sep 2015 16:36:36 +0100
changeset 264985 cf7d4d1a0810c135ae4edc6b2d1e11ce24008097
parent 264984 106456a09909fed6a7b1cc17645262d1b30e2698
child 264986 1c51a59d7233a0220d6f22bba46dee7190bb93de
push id65807
push useramarchesini@mozilla.com
push dateTue, 29 Sep 2015 15:37:01 +0000
treeherdermozilla-inbound@cf7d4d1a0810 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1209461
milestone44.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 1209461 - Remove compilation warnings in nsFrameMessageManager, r=smaug
dom/base/nsFrameMessageManager.cpp
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -1801,35 +1801,31 @@ nsMessageManagerScriptExecutor::TryCache
     options.setFileAndLine(url.get(), 1);
     options.setNoScriptRval(true);
     JS::Rooted<JSScript*> script(cx);
 
     if (aRunInGlobalScope) {
       if (!JS::Compile(cx, options, srcBuf, &script)) {
         return;
       }
-    } else {
-      // We're going to run these against some non-global scope.
-      if (!JS::CompileForNonSyntacticScope(cx, options, srcBuf, &script)) {
-        return;
-      }
+    // We're going to run these against some non-global scope.
+    } else if (!JS::CompileForNonSyntacticScope(cx, options, srcBuf, &script)) {
+      return;
     }
 
+    MOZ_ASSERT(script);
     aScriptp.set(script);
 
     nsAutoCString scheme;
     uri->GetScheme(scheme);
     // We don't cache data: scripts!
     if (aShouldCache && !scheme.EqualsLiteral("data")) {
-      nsMessageManagerScriptHolder* holder;
-
       // Root the object also for caching.
-      if (script) {
-        holder = new nsMessageManagerScriptHolder(cx, script, aRunInGlobalScope);
-      }
+      nsMessageManagerScriptHolder* holder =
+        new nsMessageManagerScriptHolder(cx, script, aRunInGlobalScope);
       sCachedScripts->Put(aURL, holder);
     }
   }
 }
 
 void
 nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
   const nsAString& aURL,