mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Merge m-c to autoland. a=merge
This commit is contained in:
commit
8ed23a6303
@ -304,6 +304,8 @@ bool nsContentUtils::sLowerNetworkPriority = false;
|
||||
#ifndef RELEASE_OR_BETA
|
||||
bool nsContentUtils::sBypassCSSOMOriginCheck = false;
|
||||
#endif
|
||||
bool nsContentUtils::sIsBytecodeCacheEnabled = false;
|
||||
int32_t nsContentUtils::sBytecodeCacheStrategy = 0;
|
||||
|
||||
int32_t nsContentUtils::sPrivacyMaxInnerWidth = 1000;
|
||||
int32_t nsContentUtils::sPrivacyMaxInnerHeight = 1000;
|
||||
@ -725,6 +727,12 @@ nsContentUtils::Init()
|
||||
Preferences::AddBoolVarCache(&sLowerNetworkPriority,
|
||||
"privacy.trackingprotection.lower_network_priority", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsBytecodeCacheEnabled,
|
||||
"dom.script_loader.bytecode_cache.enabled", false);
|
||||
|
||||
Preferences::AddIntVarCache(&sBytecodeCacheStrategy,
|
||||
"dom.script_loader.bytecode_cache.strategy", 0);
|
||||
|
||||
Element::InitCCCallbacks();
|
||||
|
||||
Unused << nsRFPService::GetOrCreate();
|
||||
|
@ -2985,6 +2985,14 @@ public:
|
||||
// if we want to lower the priority of the channel.
|
||||
static bool IsLowerNetworkPriority() { return sLowerNetworkPriority; }
|
||||
|
||||
// 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; }
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
@ -3115,6 +3123,8 @@ private:
|
||||
#ifndef RELEASE_OR_BETA
|
||||
static bool sBypassCSSOMOriginCheck;
|
||||
#endif
|
||||
static bool sIsBytecodeCacheEnabled;
|
||||
static int32_t sBytecodeCacheStrategy;
|
||||
static uint32_t sCookiesLifetimePolicy;
|
||||
static uint32_t sCookiesBehavior;
|
||||
|
||||
|
@ -121,14 +121,14 @@
|
||||
// trace these and resolve a promise with the path taken by the
|
||||
// script loader.
|
||||
//
|
||||
// Setting dom.script_loader.bytecode_cache.eager causes the
|
||||
// Setting dom.script_loader.bytecode_cache.strategy to -1 causes the
|
||||
// nsScriptLoadRequest to force all the conditions necessary to make a
|
||||
// script be saved as bytecode in the alternate data storage provided
|
||||
// by the channel (necko cache).
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
['dom.script_loader.bytecode_cache.enabled', true],
|
||||
['dom.expose_test_interfaces', true],
|
||||
['dom.script_loader.bytecode_cache.eager', true]
|
||||
['dom.script_loader.bytecode_cache.strategy', -1]
|
||||
]});
|
||||
|
||||
// Load the test page, and verify that the code path taken by the
|
||||
@ -179,7 +179,7 @@
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
['dom.script_loader.bytecode_cache.enabled', true],
|
||||
['dom.expose_test_interfaces', true],
|
||||
['dom.script_loader.bytecode_cache.eager', true]
|
||||
['dom.script_loader.bytecode_cache.strategy', -1]
|
||||
]});
|
||||
|
||||
// The test page add a new script which generate a "ping" event, which
|
||||
|
@ -363,7 +363,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() &&
|
||||
ScriptLoader::IsBytecodeCacheEnabled()) {
|
||||
nsContentUtils::IsBytecodeCacheEnabled()) {
|
||||
mRequest->mCacheInfo = do_QueryInterface(channelRequest);
|
||||
LOG(("ScriptLoadRequest (%p): nsICacheInfoChannel = %p",
|
||||
mRequest.get(), mRequest->mCacheInfo.get()));
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIOutputStream.h"
|
||||
@ -804,35 +805,6 @@ ScriptLoader::InstantiateModuleTree(ModuleLoadRequest* aRequest)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ScriptLoader::IsBytecodeCacheEnabled()
|
||||
{
|
||||
static bool sExposeTestInterfaceEnabled = false;
|
||||
static bool sExposeTestInterfacePrefCached = false;
|
||||
if (!sExposeTestInterfacePrefCached) {
|
||||
sExposeTestInterfacePrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sExposeTestInterfaceEnabled,
|
||||
"dom.script_loader.bytecode_cache.enabled",
|
||||
false);
|
||||
}
|
||||
return sExposeTestInterfaceEnabled;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ScriptLoader::IsEagerBytecodeCache()
|
||||
{
|
||||
// When testing, we want to force use of the bytecode cache.
|
||||
static bool sEagerBytecodeCache = false;
|
||||
static bool sForceBytecodeCachePrefCached = false;
|
||||
if (!sForceBytecodeCachePrefCached) {
|
||||
sForceBytecodeCachePrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sEagerBytecodeCache,
|
||||
"dom.script_loader.bytecode_cache.eager",
|
||||
false);
|
||||
}
|
||||
return sEagerBytecodeCache;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ScriptLoader::RestartLoad(ScriptLoadRequest* aRequest)
|
||||
{
|
||||
@ -940,7 +912,8 @@ ScriptLoader::StartLoad(ScriptLoadRequest* aRequest)
|
||||
// build-id is part of the kBytecodeMimeType constant.
|
||||
aRequest->mCacheInfo = nullptr;
|
||||
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
|
||||
if (cic && IsBytecodeCacheEnabled() && aRequest->mJSVersion == JSVERSION_DEFAULT) {
|
||||
if (cic && nsContentUtils::IsBytecodeCacheEnabled() &&
|
||||
aRequest->mJSVersion == JSVERSION_DEFAULT) {
|
||||
if (!aRequest->IsLoadingSource()) {
|
||||
// Inform the HTTP cache that we prefer to have information coming from the
|
||||
// bytecode cache instead of the sources, if such entry is already registered.
|
||||
@ -1882,6 +1855,157 @@ ScriptLoader::FillCompileOptionsForRequest(const AutoJSAPI&jsapi,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ScriptLoader::ShouldCacheBytecode(ScriptLoadRequest* aRequest)
|
||||
{
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::TimeDuration;
|
||||
|
||||
// We need the nsICacheInfoChannel to exist to be able to open the alternate
|
||||
// data output stream. This pointer would only be non-null if the bytecode was
|
||||
// activated at the time the channel got created in StartLoad.
|
||||
if (!aRequest->mCacheInfo) {
|
||||
LOG(("ScriptLoadRequest (%p): Cannot cache anything (cacheInfo = %p)",
|
||||
aRequest, aRequest->mCacheInfo.get()));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Look at the preference to know which strategy (parameters) should be used
|
||||
// when the bytecode cache is enabled.
|
||||
int32_t strategy = nsContentUtils::BytecodeCacheStrategy();
|
||||
|
||||
// List of parameters used by the strategies.
|
||||
bool hasSourceLengthMin = false;
|
||||
bool hasFetchCountMin = false;
|
||||
bool hasTimeSinceLastFetched = false;
|
||||
size_t sourceLengthMin = 100;
|
||||
int32_t fetchCountMin = 5;
|
||||
TimeDuration timeSinceLastFetched;
|
||||
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: strategy = %d.", aRequest, strategy));
|
||||
switch (strategy) {
|
||||
case -2: {
|
||||
// Reader mode, keep requesting alternate data but no longer save it.
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: Encoding disabled.", aRequest));
|
||||
return false;
|
||||
}
|
||||
case -1: {
|
||||
// Eager mode, skip heuristics!
|
||||
hasSourceLengthMin = false;
|
||||
hasFetchCountMin = false;
|
||||
hasTimeSinceLastFetched = false;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case 0: {
|
||||
hasSourceLengthMin = true;
|
||||
hasFetchCountMin = true;
|
||||
hasTimeSinceLastFetched = true;
|
||||
sourceLengthMin = 1024;
|
||||
fetchCountMin = 5;
|
||||
timeSinceLastFetched = TimeDuration::FromSeconds(72 * 3600);
|
||||
break;
|
||||
}
|
||||
|
||||
// The following strategies are made-up to study what impact each parameter
|
||||
// has when compared to the default case.
|
||||
case 1: {
|
||||
hasSourceLengthMin = true;
|
||||
hasFetchCountMin = true;
|
||||
hasTimeSinceLastFetched = false;
|
||||
sourceLengthMin = 1024;
|
||||
fetchCountMin = 5;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
hasSourceLengthMin = true;
|
||||
hasFetchCountMin = false;
|
||||
hasTimeSinceLastFetched = true;
|
||||
sourceLengthMin = 1024;
|
||||
timeSinceLastFetched = TimeDuration::FromSeconds(72 * 3600);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
hasSourceLengthMin = false;
|
||||
hasFetchCountMin = true;
|
||||
hasTimeSinceLastFetched = true;
|
||||
fetchCountMin = 5;
|
||||
timeSinceLastFetched = TimeDuration::FromSeconds(72 * 3600);
|
||||
break;
|
||||
}
|
||||
|
||||
// The following strategies are made-up to study what impact each parameter
|
||||
// has individually.
|
||||
case 4: {
|
||||
hasSourceLengthMin = false;
|
||||
hasFetchCountMin = false;
|
||||
hasTimeSinceLastFetched = true;
|
||||
timeSinceLastFetched = TimeDuration::FromSeconds(72 * 3600);
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
hasSourceLengthMin = false;
|
||||
hasFetchCountMin = true;
|
||||
hasTimeSinceLastFetched = false;
|
||||
fetchCountMin = 5;
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
hasSourceLengthMin = true;
|
||||
hasFetchCountMin = false;
|
||||
hasTimeSinceLastFetched = false;
|
||||
sourceLengthMin = 1024;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the script is too small/large, do not attempt at creating a bytecode
|
||||
// cache for this script, as the overhead of parsing it might not be worth the
|
||||
// effort.
|
||||
if (hasSourceLengthMin && aRequest->mScriptText.length() < sourceLengthMin) {
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: Script is too small.", aRequest));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that we loaded the cache entry a few times before attempting any
|
||||
// bytecode-cache optimization, such that we do not waste time on entry which
|
||||
// are going to be dropped soon.
|
||||
if (hasFetchCountMin) {
|
||||
int32_t fetchCount = 0;
|
||||
if (NS_FAILED(aRequest->mCacheInfo->GetCacheTokenFetchCount(&fetchCount))) {
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: Cannot get fetchCount.", aRequest));
|
||||
return false;
|
||||
}
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: fetchCount = %d.", aRequest, fetchCount));
|
||||
if (fetchCount < fetchCountMin) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that the cache entry got accessed recently, before caching it.
|
||||
if (hasTimeSinceLastFetched) {
|
||||
uint32_t lastFetched = 0;
|
||||
if (NS_FAILED(aRequest->mCacheInfo->GetCacheTokenLastFetched(&lastFetched))) {
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: Cannot get lastFetched.", aRequest));
|
||||
return false;
|
||||
}
|
||||
TimeStamp now = TimeStamp::NowLoRes();
|
||||
TimeStamp last = TimeStamp() + TimeDuration::FromSeconds(lastFetched);
|
||||
if (now < last) {
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: (What?) lastFetched set in the future.", aRequest));
|
||||
return false;
|
||||
}
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: lastFetched = %f sec. ago.",
|
||||
aRequest, (now - last).ToSeconds()));
|
||||
if (now - last >= timeSinceLastFetched) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: Trigger encoding.", aRequest));
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||
{
|
||||
@ -1987,13 +2111,7 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||
} else {
|
||||
MOZ_ASSERT(aRequest->IsSource());
|
||||
JS::Rooted<JSScript*> script(aes.cx());
|
||||
|
||||
bool encodeBytecode = false;
|
||||
if (aRequest->mCacheInfo) {
|
||||
MOZ_ASSERT(aRequest->mBytecodeOffset ==
|
||||
aRequest->mScriptBytecode.length());
|
||||
encodeBytecode = IsEagerBytecodeCache(); // Heuristic!
|
||||
}
|
||||
bool encodeBytecode = ShouldCacheBytecode(aRequest);
|
||||
|
||||
{
|
||||
nsJSUtils::ExecutionContext exec(aes.cx(), global);
|
||||
@ -2018,10 +2136,11 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
||||
aRequest->mScript = script;
|
||||
HoldJSObjects(aRequest);
|
||||
TRACE_FOR_TEST(aRequest->mElement, "scriptloader_encode");
|
||||
MOZ_ASSERT(aRequest->mBytecodeOffset == aRequest->mScriptBytecode.length());
|
||||
RegisterForBytecodeEncoding(aRequest);
|
||||
} else {
|
||||
LOG(("ScriptLoadRequest (%p): Cannot cache anything (rv = %X, script = %p, cacheInfo = %p)",
|
||||
aRequest, unsigned(rv), script.get(), aRequest->mCacheInfo.get()));
|
||||
LOG(("ScriptLoadRequest (%p): Bytecode-cache: disabled (rv = %X, script = %p)",
|
||||
aRequest, unsigned(rv), script.get()));
|
||||
TRACE_FOR_TEST_NONE(aRequest->mElement, "scriptloader_no_encode");
|
||||
aRequest->mCacheInfo = nullptr;
|
||||
}
|
||||
|
@ -468,11 +468,10 @@ private:
|
||||
friend bool
|
||||
HostResolveImportedModule(JSContext* aCx, unsigned argc, JS::Value* vp);
|
||||
|
||||
// Returns wether we should save the bytecode of this script after the
|
||||
// execution of the script.
|
||||
static bool
|
||||
IsBytecodeCacheEnabled();
|
||||
|
||||
static bool
|
||||
IsEagerBytecodeCache();
|
||||
ShouldCacheBytecode(ScriptLoadRequest* aRequest);
|
||||
|
||||
nsresult CreateModuleScript(ModuleLoadRequest* aRequest);
|
||||
nsresult ProcessFetchedModuleSource(ModuleLoadRequest* aRequest);
|
||||
|
@ -1813,6 +1813,8 @@ public:
|
||||
// matches the frame metrics array length.
|
||||
|
||||
virtual void ClearCachedResources() {}
|
||||
|
||||
virtual bool SupportsAsyncUpdate() { return false; }
|
||||
private:
|
||||
void ScrollMetadataChanged();
|
||||
public:
|
||||
|
@ -59,6 +59,14 @@ protected:
|
||||
DestroyBackBuffer();
|
||||
}
|
||||
|
||||
virtual bool SupportsAsyncUpdate() override
|
||||
{
|
||||
if (GetImageClientType() == CompositableType::IMAGE_BRIDGE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void HandleMemoryPressure() override
|
||||
{
|
||||
if (mImageClient) {
|
||||
|
@ -90,6 +90,16 @@ WebRenderImageLayer::ClearCachedResources()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
WebRenderImageLayer::SupportsAsyncUpdate()
|
||||
{
|
||||
if (GetImageClientType() == CompositableType::IMAGE_BRIDGE &&
|
||||
mPipelineId.isSome()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
WebRenderImageLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
||||
const StackingContextHelper& aSc)
|
||||
|
@ -24,6 +24,8 @@ public:
|
||||
|
||||
virtual void ClearCachedResources() override;
|
||||
|
||||
virtual bool SupportsAsyncUpdate() override;
|
||||
|
||||
protected:
|
||||
virtual ~WebRenderImageLayer();
|
||||
|
||||
|
@ -6681,8 +6681,7 @@ nsIFrame::InvalidateLayer(uint32_t aDisplayItemKey,
|
||||
|
||||
// If the layer is being updated asynchronously, and it's being forwarded
|
||||
// to a compositor, then we don't need to invalidate.
|
||||
if ((aFlags & UPDATE_IS_ASYNC) && layer &&
|
||||
layer->Manager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
|
||||
if ((aFlags & UPDATE_IS_ASYNC) && layer && layer->SupportsAsyncUpdate()) {
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,20 @@ pref("dom.script_loader.bytecode_cache.enabled", false); // Not tuned yet.
|
||||
|
||||
// Ignore the heuristics of the bytecode cache, and always record on the first
|
||||
// visit. (used for testing purposes).
|
||||
pref("dom.script_loader.bytecode_cache.eager", false);
|
||||
|
||||
// Choose one strategy to use to decide when the bytecode should be encoded and
|
||||
// saved. The following strategies are available right now:
|
||||
// * -2 : (reader mode) The bytecode cache would be read, but it would never
|
||||
// be saved.
|
||||
// * -1 : (eager mode) The bytecode would be saved as soon as the script is
|
||||
// seen for the first time, independently of the size or last access
|
||||
// time.
|
||||
// * 0 : (default) The bytecode would be saved in order to minimize the
|
||||
// page-load time.
|
||||
//
|
||||
// Other values might lead to experimental strategies. For more details, have a
|
||||
// look at: ScriptLoader::ShouldCacheBytecode function.
|
||||
pref("dom.script_loader.bytecode_cache.strategy", 0);
|
||||
|
||||
// Fastback caching - if this pref is negative, then we calculate the number
|
||||
// of content viewers to cache based on the amount of available memory.
|
||||
|
@ -9,6 +9,24 @@ interface nsIOutputStream;
|
||||
[scriptable, uuid(72c34415-c6eb-48af-851f-772fa9ee5972)]
|
||||
interface nsICacheInfoChannel : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the number of times the cache entry has been opened. This attribute is
|
||||
* equivalent to nsICachingChannel.cacheToken.fetchCount.
|
||||
*
|
||||
* @throws NS_ERROR_NOT_AVAILABLE if the cache entry or the alternate data
|
||||
* cache entry cannot be read.
|
||||
*/
|
||||
readonly attribute int32_t cacheTokenFetchCount;
|
||||
|
||||
/**
|
||||
* Get the last time the cache entry was opened from cache token. This
|
||||
* attribute is equivalent to nsICachingChannel.cacheToken.lastFetched.
|
||||
*
|
||||
* @throws NS_ERROR_NOT_AVAILABLE if the cache entry or the alternate data
|
||||
* cache entry cannot be read.
|
||||
*/
|
||||
readonly attribute uint32_t cacheTokenLastFetched;
|
||||
|
||||
/**
|
||||
* Get expiration time from cache token. This attribute is equivalent to
|
||||
* nsICachingChannel.cacheToken.expirationTime.
|
||||
|
@ -153,6 +153,9 @@ HttpChannelChild::HttpChannelChild()
|
||||
, mSynthesizedStreamLength(0)
|
||||
, mIsFromCache(false)
|
||||
, mCacheEntryAvailable(false)
|
||||
, mAltDataCacheEntryAvailable(false)
|
||||
, mCacheFetchCount(0)
|
||||
, mCacheLastFetched(0)
|
||||
, mCacheExpirationTime(nsICacheEntry::NO_EXPIRATION_TIME)
|
||||
, mSendResumeAt(false)
|
||||
, mDeletingChannelSent(false)
|
||||
@ -351,6 +354,8 @@ class StartRequestEvent : public ChannelEvent
|
||||
const nsHttpHeaderArray& aRequestHeaders,
|
||||
const bool& aIsFromCache,
|
||||
const bool& aCacheEntryAvailable,
|
||||
const int32_t& aCacheFetchCount,
|
||||
const uint32_t& aCacheLastFetched,
|
||||
const uint32_t& aCacheExpirationTime,
|
||||
const nsCString& aCachedCharset,
|
||||
const nsCString& aSecurityInfoSerialization,
|
||||
@ -366,6 +371,8 @@ class StartRequestEvent : public ChannelEvent
|
||||
, mUseResponseHead(aUseResponseHead)
|
||||
, mIsFromCache(aIsFromCache)
|
||||
, mCacheEntryAvailable(aCacheEntryAvailable)
|
||||
, mCacheFetchCount(aCacheFetchCount)
|
||||
, mCacheLastFetched(aCacheLastFetched)
|
||||
, mCacheExpirationTime(aCacheExpirationTime)
|
||||
, mCachedCharset(aCachedCharset)
|
||||
, mSecurityInfoSerialization(aSecurityInfoSerialization)
|
||||
@ -381,6 +388,7 @@ class StartRequestEvent : public ChannelEvent
|
||||
LOG(("StartRequestEvent [this=%p]\n", mChild));
|
||||
mChild->OnStartRequest(mChannelStatus, mResponseHead, mUseResponseHead,
|
||||
mRequestHeaders, mIsFromCache, mCacheEntryAvailable,
|
||||
mCacheFetchCount, mCacheLastFetched,
|
||||
mCacheExpirationTime, mCachedCharset,
|
||||
mSecurityInfoSerialization, mSelfAddr, mPeerAddr,
|
||||
mCacheKey, mAltDataType, mAltDataLen);
|
||||
@ -400,6 +408,8 @@ class StartRequestEvent : public ChannelEvent
|
||||
bool mUseResponseHead;
|
||||
bool mIsFromCache;
|
||||
bool mCacheEntryAvailable;
|
||||
int32_t mCacheFetchCount;
|
||||
uint32_t mCacheLastFetched;
|
||||
uint32_t mCacheExpirationTime;
|
||||
nsCString mCachedCharset;
|
||||
nsCString mSecurityInfoSerialization;
|
||||
@ -417,6 +427,8 @@ HttpChannelChild::RecvOnStartRequest(const nsresult& channelStatus,
|
||||
const nsHttpHeaderArray& requestHeaders,
|
||||
const bool& isFromCache,
|
||||
const bool& cacheEntryAvailable,
|
||||
const int32_t& cacheFetchCount,
|
||||
const uint32_t& cacheLastFetched,
|
||||
const uint32_t& cacheExpirationTime,
|
||||
const nsCString& cachedCharset,
|
||||
const nsCString& securityInfoSerialization,
|
||||
@ -441,8 +453,8 @@ HttpChannelChild::RecvOnStartRequest(const nsresult& channelStatus,
|
||||
mEventQ->RunOrEnqueue(new StartRequestEvent(this, channelStatus, responseHead,
|
||||
useResponseHead, requestHeaders,
|
||||
isFromCache, cacheEntryAvailable,
|
||||
cacheExpirationTime,
|
||||
cachedCharset,
|
||||
cacheFetchCount, cacheLastFetched,
|
||||
cacheExpirationTime, cachedCharset,
|
||||
securityInfoSerialization,
|
||||
selfAddr, peerAddr, cacheKey,
|
||||
altDataType, altDataLen));
|
||||
@ -462,6 +474,8 @@ HttpChannelChild::OnStartRequest(const nsresult& channelStatus,
|
||||
const nsHttpHeaderArray& requestHeaders,
|
||||
const bool& isFromCache,
|
||||
const bool& cacheEntryAvailable,
|
||||
const int32_t& cacheFetchCount,
|
||||
const uint32_t& cacheLastFetched,
|
||||
const uint32_t& cacheExpirationTime,
|
||||
const nsCString& cachedCharset,
|
||||
const nsCString& securityInfoSerialization,
|
||||
@ -494,6 +508,8 @@ HttpChannelChild::OnStartRequest(const nsresult& channelStatus,
|
||||
|
||||
mIsFromCache = isFromCache;
|
||||
mCacheEntryAvailable = cacheEntryAvailable;
|
||||
mCacheFetchCount = cacheFetchCount;
|
||||
mCacheLastFetched = cacheLastFetched;
|
||||
mCacheExpirationTime = cacheExpirationTime;
|
||||
mCachedCharset = cachedCharset;
|
||||
mSelfAddr = selfAddr;
|
||||
@ -1128,7 +1144,15 @@ HttpChannelChild::DoOnStopRequest(nsIRequest* aRequest, nsresult aChannelStatus,
|
||||
mOnStopRequestCalled = true;
|
||||
|
||||
ReleaseListeners();
|
||||
|
||||
// If a preferred alt-data type was set, the parent would hold a reference to
|
||||
// the cache entry in case the child calls openAlternativeOutputStream().
|
||||
// (see nsHttpChannel::OnStopRequest)
|
||||
if (!mPreferredCachedAltDataType.IsEmpty()) {
|
||||
mAltDataCacheEntryAvailable = mCacheEntryAvailable;
|
||||
}
|
||||
mCacheEntryAvailable = false;
|
||||
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveRequest(this, nullptr, mStatus);
|
||||
}
|
||||
@ -2657,6 +2681,30 @@ HttpChannelChild::SetupFallbackChannel(const char *aFallbackKey)
|
||||
// HttpChannelChild::nsICacheInfoChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelChild::GetCacheTokenFetchCount(int32_t *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
if (!mCacheEntryAvailable || !mAltDataCacheEntryAvailable) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
*_retval = mCacheFetchCount;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelChild::GetCacheTokenLastFetched(uint32_t *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
if (!mCacheEntryAvailable || !mAltDataCacheEntryAvailable) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
*_retval = mCacheLastFetched;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelChild::GetCacheTokenExpirationTime(uint32_t *_retval)
|
||||
{
|
||||
|
@ -127,6 +127,8 @@ protected:
|
||||
const nsHttpHeaderArray& requestHeaders,
|
||||
const bool& isFromCache,
|
||||
const bool& cacheEntryAvailable,
|
||||
const int32_t& cacheFetchCount,
|
||||
const uint32_t& cacheLastFetched,
|
||||
const uint32_t& cacheExpirationTime,
|
||||
const nsCString& cachedCharset,
|
||||
const nsCString& securityInfoSerialization,
|
||||
@ -268,6 +270,9 @@ private:
|
||||
|
||||
bool mIsFromCache;
|
||||
bool mCacheEntryAvailable;
|
||||
bool mAltDataCacheEntryAvailable;
|
||||
int32_t mCacheFetchCount;
|
||||
uint32_t mCacheLastFetched;
|
||||
uint32_t mCacheExpirationTime;
|
||||
nsCString mCachedCharset;
|
||||
|
||||
@ -360,6 +365,8 @@ private:
|
||||
const nsHttpHeaderArray& requestHeaders,
|
||||
const bool& isFromCache,
|
||||
const bool& cacheEntryAvailable,
|
||||
const int32_t& cacheFetchCount,
|
||||
const uint32_t& cacheLastFetched,
|
||||
const uint32_t& cacheExpirationTime,
|
||||
const nsCString& cachedCharset,
|
||||
const nsCString& securityInfoSerialization,
|
||||
|
@ -1413,6 +1413,10 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
||||
nsHttpRequestHead *requestHead = chan->GetRequestHead();
|
||||
bool isFromCache = false;
|
||||
chan->IsFromCache(&isFromCache);
|
||||
int32_t fetchCount = 0;
|
||||
chan->GetCacheTokenFetchCount(&fetchCount);
|
||||
uint32_t lastFetchedTime = 0;
|
||||
chan->GetCacheTokenLastFetched(&lastFetchedTime);
|
||||
uint32_t expirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
|
||||
chan->GetCacheTokenExpirationTime(&expirationTime);
|
||||
nsCString cachedCharset;
|
||||
@ -1483,7 +1487,8 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
|
||||
requestHead->Headers(),
|
||||
isFromCache,
|
||||
mCacheEntry ? true : false,
|
||||
expirationTime, cachedCharset, secInfoSerialization,
|
||||
fetchCount, lastFetchedTime, expirationTime,
|
||||
cachedCharset, secInfoSerialization,
|
||||
chan->GetSelfAddr(), chan->GetPeerAddr(),
|
||||
redirectCount,
|
||||
cacheKeyValue,
|
||||
|
@ -98,6 +98,8 @@ child:
|
||||
nsHttpHeaderArray requestHeaders,
|
||||
bool isFromCache,
|
||||
bool cacheEntryAvailable,
|
||||
int32_t cacheFetchCount,
|
||||
uint32_t cacheLastFetched,
|
||||
uint32_t cacheExpirationTime,
|
||||
nsCString cachedCharset,
|
||||
nsCString securityInfoSerialization,
|
||||
|
@ -7698,6 +7698,30 @@ nsHttpChannel::IsFromCache(bool *value)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetCacheTokenFetchCount(int32_t *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsCOMPtr<nsICacheEntry> cacheEntry = mCacheEntry ? mCacheEntry : mAltDataCacheEntry;
|
||||
if (!cacheEntry) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return cacheEntry->GetFetchCount(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetCacheTokenLastFetched(uint32_t *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsCOMPtr<nsICacheEntry> cacheEntry = mCacheEntry ? mCacheEntry : mAltDataCacheEntry;
|
||||
if (!cacheEntry) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return cacheEntry->GetLastFetched(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::GetCacheTokenExpirationTime(uint32_t *_retval)
|
||||
{
|
||||
|
@ -1161,4 +1161,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
|
||||
|
||||
static const int32_t kUnknownId = -1;
|
||||
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1505056536555000);
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1505144199893000);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -36,8 +36,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
Cu.importGlobalProperties(["URL"]);
|
||||
|
||||
const INPUT_DATETIME_PREF = "dom.forms.datetime";
|
||||
|
||||
var contentLog = new logging.ContentLogger();
|
||||
|
||||
var marionetteTestName;
|
||||
@ -1441,7 +1439,7 @@ function* sendKeysToElement(id, val) {
|
||||
if (el.type == "file") {
|
||||
yield interaction.uploadFile(el, val);
|
||||
} else if ((el.type == "date" || el.type == "time") &&
|
||||
Preferences.get(INPUT_DATETIME_PREF)) {
|
||||
Preferences.get("dom.forms.datetime")) {
|
||||
yield interaction.setFormControlValue(el, val);
|
||||
} else {
|
||||
yield interaction.sendKeysToElement(
|
||||
|
Loading…
Reference in New Issue
Block a user