Bug 1383215: Part 3 - Use scache::ResolveURI to resolve module URIs. r=mccr8
authorKris Maglione <maglione.k@gmail.com>
Fri, 21 Jul 2017 15:42:38 -0700
changeset 370663 5cfde6ac518b8a8704c090f4f46bbb0996665b72
parent 370662 93ef01e8aee53dc19814a9040fd503853fe12bae
child 370664 03777f604c6ca9dd56de4d8314284f7303fda46b
push id92912
push usermaglione.k@gmail.com
push dateTue, 25 Jul 2017 03:59:34 +0000
treeherdermozilla-inbound@df302a197bca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1383215
milestone56.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 1383215: Part 3 - Use scache::ResolveURI to resolve module URIs. r=mccr8 Since we now usually load modules from one of the startup caches, we usually have no need to ever actually create a channel in order to load them. Resolving the URIs directly is much cheaper in the normal case. MozReview-Commit-ID: 8W8RMHRnyBa
js/xpconnect/loader/mozJSComponentLoader.cpp
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -241,18 +241,18 @@ class MOZ_STACK_CLASS ComponentLoaderInf
                              nullptr, // aLoadGroup
                              nullptr, // aCallbacks
                              nsIRequest::LOAD_NORMAL,
                              mIOService);
     }
 
     nsIURI* ResolvedURI() { MOZ_ASSERT(mResolvedURI); return mResolvedURI; }
     nsresult EnsureResolvedURI() {
-        BEGIN_ENSURE(ResolvedURI, ScriptChannel);
-        return mScriptChannel->GetURI(getter_AddRefs(mResolvedURI));
+        BEGIN_ENSURE(ResolvedURI, URI);
+        return ResolveURI(mURI, getter_AddRefs(mResolvedURI));
     }
 
     nsAutoCString& Key() { return *mKey; }
     nsresult EnsureKey() {
         ENSURE_DEPS(ResolvedURI);
         mKey.emplace();
         return mResolvedURI->GetSpec(*mKey);
     }
@@ -608,18 +608,20 @@ mozJSComponentLoader::ObjectForLocation(
 
     // Before compiling the script, first check to see if we have it in
     // the startupcache.  Note: as a rule, startupcache errors are not fatal
     // to loading the script, since we can always slow-load.
 
     bool writeToCache = false;
     StartupCache* cache = StartupCache::GetSingleton();
 
+    aInfo.EnsureResolvedURI();
+
     nsAutoCString cachePath(kJSCachePrefix);
-    rv = PathifyURI(aInfo.URI(), cachePath);
+    rv = PathifyURI(aInfo.ResolvedURI(), cachePath);
     NS_ENSURE_SUCCESS(rv, rv);
 
     script = ScriptPreloader::GetSingleton().GetCachedScript(cx, cachePath);
     if (!script && cache) {
         ReadCachedScript(cache, cachePath, cx, &script);
     }
 
     if (script) {