зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1398499: Part 1 - Use separate cache paths for shared/unshared scripts. r=mccr8
Scripts for use in shared globals need to be compiled for non-syntactic scopes, while scripts for standalone globals should be compiled as global scripts for better performance. Since the startup cache and script preloader store scripts as they were compiled in the last session, when global sharing settings may have been different, it can lead to a mismatch, and a crash, due to loading the wrong type of script. Using a separate cache path for each type of script fixes this problem, since it ensures that the cached script will always be of the type we expect. MozReview-Commit-ID: DnNb2Xi6KeL --HG-- extra : rebase_source : d2474d1da3f8e1066c21a7c65693ea09ec5b8074
This commit is contained in:
Родитель
bb4a414d58
Коммит
8b676de4b0
|
@ -60,7 +60,8 @@ using namespace xpc;
|
|||
using namespace JS;
|
||||
|
||||
static const char kObserverServiceContractID[] = "@mozilla.org/observer-service;1";
|
||||
static const char kJSCachePrefix[] = "jsloader";
|
||||
|
||||
#define JS_CACHE_PREFIX(aType) "jsloader/" aType
|
||||
|
||||
/**
|
||||
* Buffer sizes for serialization and deserialization of scripts.
|
||||
|
@ -701,7 +702,8 @@ mozJSComponentLoader::ObjectForLocation(ComponentLoaderInfo& aInfo,
|
|||
|
||||
aInfo.EnsureResolvedURI();
|
||||
|
||||
nsAutoCString cachePath(kJSCachePrefix);
|
||||
nsAutoCString cachePath(reuseGlobal ? JS_CACHE_PREFIX("non-syntactic")
|
||||
: JS_CACHE_PREFIX("global"));
|
||||
rv = PathifyURI(aInfo.ResolvedURI(), cachePath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче