diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index 9be1d219b713..8d3fc4923bab 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -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) { diff --git a/js/xpconnect/loader/mozJSLoaderUtils.cpp b/js/xpconnect/loader/mozJSLoaderUtils.cpp index 3adc9741f7a6..522d85c304b9 100644 --- a/js/xpconnect/loader/mozJSLoaderUtils.cpp +++ b/js/xpconnect/loader/mozJSLoaderUtils.cpp @@ -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); diff --git a/js/xpconnect/loader/mozJSLoaderUtils.h b/js/xpconnect/loader/mozJSLoaderUtils.h index 852e06b8d486..74097c39c6bf 100644 --- a/js/xpconnect/loader/mozJSLoaderUtils.h +++ b/js/xpconnect/loader/mozJSLoaderUtils.h @@ -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, diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp index f0acfb08bfd3..13b99a3659e0 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -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.