Bug 1379023, part 3 - Make WriteCachedScript assert about the system principal not require the argument. r=mrbkap

MozReview-Commit-ID: FRgjZ32ULqj
This commit is contained in:
Andrew McCreight
2017-07-07 11:27:53 -07:00
parent 30fc68cb25
commit cb87257422
4 changed files with 5 additions and 21 deletions

View File

@@ -204,19 +204,6 @@ EvalScript(JSContext* cx,
cachePath.AppendPrintf("jssubloader/%d", version);
PathifyURI(uri, cachePath);
nsCOMPtr<nsIScriptSecurityManager> secman =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
if (!secman) {
return false;
}
nsCOMPtr<nsIPrincipal> principal;
nsresult rv = secman->GetSystemPrincipal(getter_AddRefs(principal));
if (NS_FAILED(rv) || !principal) {
ReportError(cx, LOAD_ERROR_NOPRINCIPALS, uri);
return false;
}
nsCString uriStr;
if (preloadCache && NS_SUCCEEDED(uri->GetSpec(uriStr))) {
// Note that, when called during startup, this will keep the
@@ -244,8 +231,7 @@ EvalScript(JSContext* cx,
if (startupCache) {
JSAutoCompartment ac(cx, script);
WriteCachedScript(StartupCache::GetSingleton(),
cachePath, cx, principal, script);
WriteCachedScript(StartupCache::GetSingleton(), cachePath, cx, script);
}
}