зеркало из 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 =
|
script =
|
||||||
ScriptPreloader::GetSingleton().GetCachedScript(cx, options, cachePath);
|
ScriptPreloader::GetSingleton().GetCachedScript(cx, options, cachePath);
|
||||||
if (!script && cache) {
|
if (!script && cache) {
|
||||||
ReadCachedScript(cache, cachePath, cx, &script);
|
ReadCachedScript(cache, cachePath, cx, options, &script);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (script) {
|
if (script) {
|
||||||
|
|
|
@ -19,8 +19,8 @@ using mozilla::UniquePtr;
|
||||||
// principals when writing a script. Instead, when reading it back, we set the
|
// principals when writing a script. Instead, when reading it back, we set the
|
||||||
// principals to the system principals.
|
// principals to the system principals.
|
||||||
nsresult ReadCachedScript(StartupCache* cache, nsACString& uri, JSContext* cx,
|
nsresult ReadCachedScript(StartupCache* cache, nsACString& uri, JSContext* cx,
|
||||||
|
const JS::ReadOnlyCompileOptions& options,
|
||||||
MutableHandleScript scriptp) {
|
MutableHandleScript scriptp) {
|
||||||
JS::CompileOptions options(cx); // FIXME: receive from caller.
|
|
||||||
const char* buf;
|
const char* buf;
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
nsresult rv = cache->GetBuffer(PromiseFlatCString(uri).get(), &buf, &len);
|
nsresult rv = cache->GetBuffer(PromiseFlatCString(uri).get(), &buf, &len);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
|
|
||||||
|
#include "js/CompileOptions.h" // JS::ReadOnlyCompileOptions
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace scache {
|
namespace scache {
|
||||||
class StartupCache;
|
class StartupCache;
|
||||||
|
@ -16,7 +18,9 @@ class StartupCache;
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
nsresult ReadCachedScript(mozilla::scache::StartupCache* cache, nsACString& uri,
|
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,
|
nsresult WriteCachedScript(mozilla::scache::StartupCache* cache,
|
||||||
nsACString& uri, JSContext* cx,
|
nsACString& uri, JSContext* cx,
|
||||||
|
|
|
@ -482,7 +482,7 @@ nsresult mozJSSubScriptLoader::DoLoadSubScriptWithOptions(
|
||||||
cx, compileOptions, cachePath);
|
cx, compileOptions, cachePath);
|
||||||
}
|
}
|
||||||
if (!script && cache) {
|
if (!script && cache) {
|
||||||
rv = ReadCachedScript(cache, cachePath, cx, &script);
|
rv = ReadCachedScript(cache, cachePath, cx, compileOptions, &script);
|
||||||
}
|
}
|
||||||
if (NS_FAILED(rv) || !script) {
|
if (NS_FAILED(rv) || !script) {
|
||||||
// ReadCachedScript may have set a pending exception.
|
// ReadCachedScript may have set a pending exception.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче