зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1379023, part 3 - Make WriteCachedScript assert about the system principal not require the argument. r=mrbkap
MozReview-Commit-ID: FRgjZ32ULqj --HG-- extra : rebase_source : be20c846efd3a5d5ba52ca1f614a0b40775d5e01
This commit is contained in:
Родитель
ef5af5fdf2
Коммит
93029d4038
|
@ -715,8 +715,7 @@ mozJSComponentLoader::ObjectForLocation(ComponentLoaderInfo& aInfo,
|
|||
|
||||
if (writeToCache) {
|
||||
// We successfully compiled the script, so cache it.
|
||||
rv = WriteCachedScript(cache, cachePath, cx, mSystemPrincipal,
|
||||
script);
|
||||
rv = WriteCachedScript(cache, cachePath, cx, script);
|
||||
|
||||
// Don't treat failure to write as fatal, since we might be working
|
||||
// with a read-only cache.
|
||||
|
|
|
@ -45,9 +45,9 @@ ReadCachedScript(StartupCache* cache, nsACString& uri, JSContext* cx,
|
|||
|
||||
nsresult
|
||||
WriteCachedScript(StartupCache* cache, nsACString& uri, JSContext* cx,
|
||||
nsIPrincipal* systemPrincipal, HandleScript script)
|
||||
HandleScript script)
|
||||
{
|
||||
MOZ_ASSERT(JS_GetScriptPrincipals(script) == nsJSPrincipals::get(systemPrincipal));
|
||||
MOZ_ASSERT(nsJSPrincipals::get(JS_GetScriptPrincipals(script))->GetIsSystemPrincipal());
|
||||
|
||||
JS::TranscodeBuffer buffer;
|
||||
JS::TranscodeResult code = JS::EncodeScript(cx, buffer, script);
|
||||
|
|
|
@ -21,7 +21,6 @@ ReadCachedScript(mozilla::scache::StartupCache* cache, nsACString& uri,
|
|||
|
||||
nsresult
|
||||
WriteCachedScript(mozilla::scache::StartupCache* cache, nsACString& uri,
|
||||
JSContext* cx, nsIPrincipal* systemPrincipal,
|
||||
JS::HandleScript script);
|
||||
JSContext* cx, JS::HandleScript script);
|
||||
|
||||
#endif /* mozJSLoaderUtils_h */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче