mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - dom.script_loader.bytecode_cache.enabled, r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D29523 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
81a8b494c1
commit
da4c1080ef
@ -314,7 +314,6 @@ bool nsContentUtils::sInitialized = false;
|
||||
bool nsContentUtils::sBypassCSSOMOriginCheck = false;
|
||||
#endif
|
||||
|
||||
bool nsContentUtils::sIsBytecodeCacheEnabled = false;
|
||||
int32_t nsContentUtils::sBytecodeCacheStrategy = 0;
|
||||
nsCString* nsContentUtils::sJSBytecodeMimeType = nullptr;
|
||||
|
||||
@ -612,10 +611,6 @@ nsresult nsContentUtils::Init() {
|
||||
sBypassCSSOMOriginCheck = getenv("MOZ_BYPASS_CSSOM_ORIGIN_CHECK");
|
||||
#endif
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsBytecodeCacheEnabled,
|
||||
"dom.script_loader.bytecode_cache.enabled",
|
||||
false);
|
||||
|
||||
Preferences::AddBoolVarCache(
|
||||
&sAntiTrackingControlCenterUIEnabled,
|
||||
"browser.contentblocking.rejecttrackers.control-center.ui.enabled",
|
||||
|
@ -3188,10 +3188,6 @@ class nsContentUtils {
|
||||
*/
|
||||
static bool GetUserIsInteracting();
|
||||
|
||||
// Check pref "dom.script_loader.bytecode_cache.enabled" to see
|
||||
// if we want to cache JS bytecode on the cache entry.
|
||||
static bool IsBytecodeCacheEnabled() { return sIsBytecodeCacheEnabled; }
|
||||
|
||||
// Check pref "dom.script_loader.bytecode_cache.strategy" to see which
|
||||
// heuristic strategy should be used to trigger the caching of the bytecode.
|
||||
static int32_t BytecodeCacheStrategy() { return sBytecodeCacheStrategy; }
|
||||
@ -3407,7 +3403,6 @@ class nsContentUtils {
|
||||
#ifndef RELEASE_OR_BETA
|
||||
static bool sBypassCSSOMOriginCheck;
|
||||
#endif
|
||||
static bool sIsBytecodeCacheEnabled;
|
||||
static int32_t sBytecodeCacheStrategy;
|
||||
static bool sAntiTrackingControlCenterUIEnabled;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -407,7 +408,7 @@ ScriptLoadHandler::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
||||
// Everything went well, keep the CacheInfoChannel alive such that we can
|
||||
// later save the bytecode on the cache entry.
|
||||
if (NS_SUCCEEDED(rv) && mRequest->IsSource() &&
|
||||
nsContentUtils::IsBytecodeCacheEnabled()) {
|
||||
StaticPrefs::dom_script_loader_bytecode_cache_enabled()) {
|
||||
mRequest->mCacheInfo = do_QueryInterface(channelRequest);
|
||||
LOG(("ScriptLoadRequest (%p): nsICacheInfoChannel = %p", mRequest.get(),
|
||||
mRequest->mCacheInfo.get()));
|
||||
|
@ -1285,7 +1285,7 @@ nsresult ScriptLoader::StartLoad(ScriptLoadRequest* aRequest) {
|
||||
// constant.
|
||||
aRequest->mCacheInfo = nullptr;
|
||||
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
|
||||
if (cic && nsContentUtils::IsBytecodeCacheEnabled() &&
|
||||
if (cic && StaticPrefs::dom_script_loader_bytecode_cache_enabled() &&
|
||||
// Bug 1436400: no bytecode cache support for modules yet.
|
||||
!aRequest->IsModuleRequest()) {
|
||||
if (!aRequest->IsLoadingSource()) {
|
||||
|
@ -538,6 +538,16 @@ VARCACHE_PREF(
|
||||
)
|
||||
#endif
|
||||
|
||||
// Whether to enable the JavaScript start-up cache. This causes one of the first
|
||||
// execution to record the bytecode of the JavaScript function used, and save it
|
||||
// in the existing cache entry. On the following loads of the same script, the
|
||||
// bytecode would be loaded from the cache instead of being generated once more.
|
||||
VARCACHE_PREF(
|
||||
"dom.script_loader.bytecode_cache.enabled",
|
||||
dom_script_loader_bytecode_cache_enabled,
|
||||
bool, true
|
||||
)
|
||||
|
||||
// IMPORTANT: Keep this in condition in sync with all.js. The value
|
||||
// of MOZILLA_OFFICIAL is different between full and artifact builds, so without
|
||||
// it being specified there, dump is disabled in artifact builds (see Bug 1490412).
|
||||
|
@ -232,12 +232,6 @@ pref("dom.inputevent.inputtype.enabled", true);
|
||||
// Whether the WebMIDI API is enabled
|
||||
pref("dom.webmidi.enabled", false);
|
||||
|
||||
// Whether to enable the JavaScript start-up cache. This causes one of the first
|
||||
// execution to record the bytecode of the JavaScript function used, and save it
|
||||
// in the existing cache entry. On the following loads of the same script, the
|
||||
// bytecode would be loaded from the cache instead of being generated once more.
|
||||
pref("dom.script_loader.bytecode_cache.enabled", true);
|
||||
|
||||
// Ignore the heuristics of the bytecode cache, and always record on the first
|
||||
// visit. (used for testing purposes).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user