Bug 1361900: Part 8 - Use the script preloader in content processes in the frame script loader. r?gabor draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 30 Apr 2017 21:54:31 -0700
changeset 577045 d4845037b2c404574c4892420655fc88b47d1091
parent 577044 995219df7ebf66f3c34f3332ec4e35c846812df2
child 577046 8ea012bb48b31539319d685a9041e71105196133
push id58588
push usermaglione.k@gmail.com
push dateFri, 12 May 2017 19:00:00 +0000
reviewersgabor
bugs1361900
milestone55.0a1
Bug 1361900: Part 8 - Use the script preloader in content processes in the frame script loader. r?gabor MozReview-Commit-ID: f7AdQ5cG4k
dom/base/nsFrameMessageManager.cpp
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -1603,19 +1603,17 @@ nsMessageManagerScriptExecutor::TryCache
   // to avoid keeping the current compartment alive.
   AutoJSAPI jsapi;
   if (!jsapi.Init(xpc::CompilationScope())) {
     return;
   }
   JSContext* cx = jsapi.cx();
   JS::Rooted<JSScript*> script(cx);
 
-  if (XRE_IsParentProcess()) {
-    script = ScriptPreloader::GetChildSingleton().GetCachedScript(cx, url);
-  }
+  script = ScriptPreloader::GetChildSingleton().GetCachedScript(cx, url);
 
   if (!script) {
     nsCOMPtr<nsIChannel> channel;
     NS_NewChannel(getter_AddRefs(channel),
                   uri,
                   nsContentUtils::GetSystemPrincipal(),
                   nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                   nsIContentPolicy::TYPE_OTHER);
@@ -1668,19 +1666,17 @@ nsMessageManagerScriptExecutor::TryCache
 
   MOZ_ASSERT(script);
   aScriptp.set(script);
 
   nsAutoCString scheme;
   uri->GetScheme(scheme);
   // We don't cache data: scripts!
   if (aShouldCache && !scheme.EqualsLiteral("data")) {
-    if (XRE_IsParentProcess()) {
-      ScriptPreloader::GetChildSingleton().NoteScript(url, url, script);
-    }
+    ScriptPreloader::GetChildSingleton().NoteScript(url, url, script);
     // Root the object also for caching.
     auto* holder = new nsMessageManagerScriptHolder(cx, script, aRunInGlobalScope);
     sCachedScripts->Put(aURL, holder);
   }
 }
 
 void
 nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(