зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1666683 - Part 4: Add options parameter to ReadCachedScript in mozJSLoaderUtils. r=tcampbell,kmag
Differential Revision: https://phabricator.services.mozilla.com/D92406
This commit is contained in:
Родитель
f1c1132d55
Коммит
cecfd1a80f
|
@ -738,7 +738,7 @@ nsresult mozJSComponentLoader::ObjectForLocation(
|
|||
script =
|
||||
ScriptPreloader::GetSingleton().GetCachedScript(cx, options, cachePath);
|
||||
if (!script && cache) {
|
||||
ReadCachedScript(cache, cachePath, cx, &script);
|
||||
ReadCachedScript(cache, cachePath, cx, options, &script);
|
||||
}
|
||||
|
||||
if (script) {
|
||||
|
|
|
@ -19,8 +19,8 @@ using mozilla::UniquePtr;
|
|||
// principals when writing a script. Instead, when reading it back, we set the
|
||||
// principals to the system principals.
|
||||
nsresult ReadCachedScript(StartupCache* cache, nsACString& uri, JSContext* cx,
|
||||
const JS::ReadOnlyCompileOptions& options,
|
||||
MutableHandleScript scriptp) {
|
||||
JS::CompileOptions options(cx); // FIXME: receive from caller.
|
||||
const char* buf;
|
||||
uint32_t len;
|
||||
nsresult rv = cache->GetBuffer(PromiseFlatCString(uri).get(), &buf, &len);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "js/CompileOptions.h" // JS::ReadOnlyCompileOptions
|
||||
|
||||
namespace mozilla {
|
||||
namespace scache {
|
||||
class StartupCache;
|
||||
|
@ -16,7 +18,9 @@ class StartupCache;
|
|||
} // namespace mozilla
|
||||
|
||||
nsresult ReadCachedScript(mozilla::scache::StartupCache* cache, nsACString& uri,
|
||||
JSContext* cx, JS::MutableHandleScript scriptp);
|
||||
JSContext* cx,
|
||||
const JS::ReadOnlyCompileOptions& options,
|
||||
JS::MutableHandleScript scriptp);
|
||||
|
||||
nsresult WriteCachedScript(mozilla::scache::StartupCache* cache,
|
||||
nsACString& uri, JSContext* cx,
|
||||
|
|
|
@ -482,7 +482,7 @@ nsresult mozJSSubScriptLoader::DoLoadSubScriptWithOptions(
|
|||
cx, compileOptions, cachePath);
|
||||
}
|
||||
if (!script && cache) {
|
||||
rv = ReadCachedScript(cache, cachePath, cx, &script);
|
||||
rv = ReadCachedScript(cache, cachePath, cx, compileOptions, &script);
|
||||
}
|
||||
if (NS_FAILED(rv) || !script) {
|
||||
// ReadCachedScript may have set a pending exception.
|
||||
|
|
Загрузка…
Ссылка в новой задаче