CachePerfStats gathers performance data for single open, read and write operations as well as the whole cache entry opening. It maintains long term and short term average. The long term average filters out excessive values and it represents and average time for a given operation when the cache is not busy. The short term average represents the current cache speed. By comparing these two stats we know pretty quickly that the cache is getting slower and then we race the cache with network immediately without a delay. Otherwise the delay is based on the average cache entry open time.
Changes to Promise tests designed to test .then(null) have been reverted, and the browser/extensions directory was excluded because the projects it contains have a separate process for accepting changes.
MozReview-Commit-ID: 1buqgX1EP4P
--HG--
extra : rebase_source : 3a9ea310d3e4a8642aabbc10636c04bfe2e77070
As part of network security, we currently crash the main process in NeckoParent::GetValidatedOriginAttributes if the SerializedLoadContext is null. This makes it difficult to find out who created the channel that has a null SLC. Adding this assertion to the child allows us to get a nice stack trace and maybe identify the root cause.
MozReview-Commit-ID: 7rz91oEaiRi
--HG--
extra : rebase_source : b411e1e9494623bacb506a2f820902a3f7aa7c2a
Add a field to the HSTS cache which indicates the source of the HSTS
entry if known, from the preload list, organically seen header, or HSTS
priming, or unknown otherwise. Also adds telemetry to collect the source
when upgrading in NS_ShouldSecureUpgrade.
MozReview-Commit-ID: 3IwyYe3Cn73
--HG--
extra : rebase_source : 9b8daac3aa02bd7a1b4285fb1e5731a817a76b7f
This patch makes navigator object to return spoofed value for fields have fingerprintable
concerns. This changes the worker navigator as well.
MozReview-Commit-ID: E2SLNZRfuVP
--HG--
extra : rebase_source : 960bafbe41382eba891ad807c37a822ba6a758c8
This patch makes nsHttpHandler to use a spoofed userAgent in the User-Agent header
when 'privacy.resistFingerprinting' is true, the spoofed userAgent string has a
fixed appName, platform and buildID. The only variant in it is the version number,
it will be rounded to the nearest 10(e.g. 40, 50, 60) for reducing fingerprinting
across release versions.
MozReview-Commit-ID: BTGuIJp94U1
--HG--
extra : rebase_source : ab0b6379630c0e962636e624f2caccca6cc9f934
As a follow-up from bug 1206961, we will remove calling CanLoadImage in
this bug. Also in the case of CSP check failed, we will call
SetBlockedRequest in those cases.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1267075#c30 for the
analysis between the old and new setup.
Setting mFirstResponseSource in nsHttpChannel::OnStartRequest when cache wins is too late, because the channel might already started redirecting in nsHttpChannel::ReadFromCache. In this case nsHttpChannel::OnStartRequest is not call at all for the cache pump and we would proceed the network response which should be ignored.
Since the uri classifier needs topWindowURI to decide whether or not to enable channel annotation, we have to allow to change this attribute in js for passing the test.
--HG--
extra : rebase_source : c5effa05fecef0d32600e4c9c926dbfa77c2ca6f
This patch includes two changes:
1. The current channel annotation is happened at nsChannelClassifier::OnClassifyComplete and this is too late because this channel might be already hit the network.
This patch adds a new API CheckIsTrackerWithLocalTable in nsChannelClassifier to check if the URI is in local blacklist and whitelist before calling BeginConnectActual.
Please note that whitelist will be checked only when TP is disabled.
2. Skip channel annotation for first-party and top-level load http channels
--HG--
extra : rebase_source : 78f98f8200d3dbb1cb96cd0a33901b2a82227974
This is a preexisting issue that makes nsMultiplexInputStream multiple-inherit
from nsIInputStream: once via nsIMultipartInputStream and once via
nsIAsyncInputStream. This causes problems once we end up with more multiplex
streams that are async streams, because then some assingments to
nsCOMPtr<nsIInputStream> start asserting. This patch just removes the footgun
by getting rid of the multiple inheritance.
The original code creates nsChannelClassifier and calls ShouldEnableTrackingProtection twice when TP is enabled. To avoid redundancy, this patch makes channel classifier as a data member in nsHttpChannel. Note that the data member is a weak ptr to prevent ref count cycle.
--HG--
extra : rebase_source : 11d2e17c2b45b70e3cd407d882ddf0c57ad51755
Collect telemetry for all requests to get an exact percentage of
requests that are subject to HSTS priming, and how many result in an
HSTS Priming request being sent. Clean up telemetry to remove instances
of double counting requests if a priming request was sent.
HSTSPrimingListener::ReportTiming was using mCallback to calculate
timing telemetry, but we were calling swap() on the nsCOMPtr. Give it an
explicit argument for the callback.
Add tests for telemetry values to all of the HSTS priming tests. This
tests for the minimum as telemetry may be gathered on background or
other requests.
MozReview-Commit-ID: 5V2Nf0Ugc3r
--HG--
extra : rebase_source : daa357219a77d912a78b95a703430f39d884c6ab
This patch contains two parts below:
1. mNeckoTarget
Since almost all child channels in necko need mNeckoTarget to dispatch runnables to main thread, it seems worth to have a holder class of mNeckoTarget and ask child channels to inherit it.
2. ChannelEvent
A lot of classes in FTPChannelChild and HttpChannelChild inheriting ChannelEvent and override GetEventTarget. It should be worth to extract the same code and put it in the same space.
This removes unnecessary COM overhead from the extension protocol service,
particularly from the flag lookup code, which is called often, and from hot
paths. The devirtualized lookups should have virtually no overhead for
extensions without web-accessible resources, and very little overhead except
when resources are specified as non-prefix globs.
MozReview-Commit-ID: 4hQ7GuQSjvW
--HG--
extra : rebase_source : 61897a204abd915ad61852fa475cde2de51753f3
NotifyTrackingProtectionDisabled/NotifyTrackingResource/SetClassifierMatchedInfo updates tracking protection and safe browsing states from parent to child.
They should at least handled by child process before OnStopRequest. Move them to PHttpBackgroundChannel can ensure that.
MozReview-Commit-ID: 8T6k9z9FgrI
--HG--
extra : rebase_source : fd26e2b4309a31e0a9bb16c9236eb4a1875518dc
OnStartRequestSent is used to ensure the execution order between OnStartRequest and all other messsages sent over PBackground.
IPC messages sent before OnStartRequestSent can be processed immediately while received by content process.
IPC messages sent after OnSartRequestSent need to be pending until OnStartRequestReceived is called.
MozReview-Commit-ID: 5Vbb8SBQmW8
--HG--
extra : rebase_source : 81ddce949d2a658e227e1e67d7d4313f7c66513f
PHttpBackgroundChannel is created by content process because PBackground IPDL
can only be initiated from content process. The background channel deletion is
controlled by chrome process while PHttpChannel is going to be closed or canceled.
BackgroundChannelRegistrar is introduced for pairing HttpChannelParent and
HttpBackgroundChannelParent since they are created over different IPDL
asynchronously.
nsIParentRedirectingChannel.continueVerification is introduced to asynchronously
wait for background channel to be established on the new channel during the
Redirect2Verify phase.
MozReview-Commit-ID: 41l8ivan8iA
--HG--
extra : rebase_source : b8b6d7e7c037efaa9fc13df14191205c603e833a
AsyncOpen procedure can failed and trigger FailedAsyncOpen IPC to do the clean up.
However FailedAsyncOpen might not complete if content process is destroyed at the meantime.
We can delay the timing of holding the strong reference to parent listener and channel object
to make sure no reference cycle is created by HttpChannelParent. In addition, clean up the
strong reference as soon as FailedAsyncOpen IPC is triggered.
MozReview-Commit-ID: LDOt0BpBgFe
--HG--
extra : rebase_source : 38e1128e8c361a2422ec4d8292b591ab3b3ef41f
PHttpBackgroundChannel is introduced to deliver OnStopRequest/OnTransportAndData/OnProgress/OnStatus on background thread.
FlushedForDiversion/DivertMessages is moved to PHttpBackgroundChannel to ensure no more channel event are delivered after these two messages on the background channel.
OnStartRequestSent is introduced to synchronize the execution order between OnStartRequest (main thread IPC) and all other messages on PHttpBackgroundChannel.
MozReview-Commit-ID: HfqvPML6EKw
--HG--
extra : rebase_source : 423709763e1abf1362347bc2d3141e2d33aed46a
When the last request is removed from the load group, we report telemetry for the default load request. This was done without checking if the request was successful, which may cause us to report telemetry for failed requests as well.
Also, the NullHttpChannel had its timingEnabled attribute set to true, which could lead us to report invalid telemetry
MozReview-Commit-ID: 5w7rd2V17Xd
--HG--
extra : rebase_source : 60785ebc38da8880aa6ded668fed8af81c3d60e9
1. Use ScopeExit to ensure mListener->OnStartRequest() is invoked before exit CallOnStartRequest.
2. Add assertion to ensure OnStartRequest called before OnStopRequest.
MozReview-Commit-ID: FgONlk5HPNz
--HG--
extra : rebase_source : ffe386bc8bea6defb216ecf149a29deacdb3737a
UAOverridesBootstrapper.js is introduced to delay the initialization of
UserAgentOverrides.jsm until the creation of the first nsHttpChannel.
Uninit will be triggered at profile-change-net-teardown because no network
traffice after this point.
MozReview-Commit-ID: F8Lpn6RyZEm
--HG--
extra : rebase_source : 7c3649b50ad8594dc0968961fbbd2766d0d98b0a
system-info might need to be construct while creating nsHttpHandler and it might take up to 30ms.
Lazy loading the DEFAULT_UA can delay the creation of nsHttpHandler after start-up.
MozReview-Commit-ID: FtIpKjcY38r
--HG--
extra : rebase_source : 8061ed3ce6c42955e52f494166958f5b63ab940b
This function is arguably nicer than calling NS_ProcessNextEvent
manually, is slightly more efficient, and will enable better auditing
for NS_ProcessNextEvent when we do Quantum DOM scheduling changes.
nsAHttpTransaction::Available() obtained a bytecount from the abstract
transaction's input stream. If that stream was derived from a file://
it would create janky IO - so remove the interface.
Http2Push maintains a non-inherited interface which is used to check
the number of bytes it has internally buffered in memory.
MozReview-Commit-ID: IQHt8yGsqDE
--HG--
extra : rebase_source : 64449c6bd743119ea7626a3b2b2b91a376280021
UAOverridesBootstrapper.js is introduced to delay the initialization of
UserAgentOverrides.jsm until the creation of nsHttpHandler in chrome process.
Uninit will be triggered at profile-change-net-teardown because no network
traffice after this point.
MozReview-Commit-ID: F8Lpn6RyZEm
--HG--
extra : rebase_source : b516209f96ec81deb54aab3c038803beb3cea441
system-info might need to be construct while creating nsHttpHandler and it might take up to 30ms.
Lazy loading the DEFAULT_UA can delay the creation of nsHttpHandler after start-up.
MozReview-Commit-ID: FtIpKjcY38r
--HG--
extra : rebase_source : 8061ed3ce6c42955e52f494166958f5b63ab940b
This is also the non-broken way to fix bug 1346392. Instead of waiting
until the auth handler gets its hands on things, we break layering a bit
and inspect the response headers as soon as we decompress them to see if
there's any connection-oriented auth being requested. If there is, we
treat the situation as if we got a RST_STREAM or GOAWAY with
HTTP_1_1_REQUIRED.
We were able to re-purpose the NS_ERROR_ABORT code path that was
previously used with an inappropriate HTTP status code when talking to
an HTTPS proxy over http/2, as that usage was removed a while back from
the stream, though we still had the (dead) code in the session to handle
the stream giving us that return value. The error code was changed to
NS_ERROR_NET_RESET, however, to give a better description of what's
going on.
MozReview-Commit-ID: DLjOIIiXGrV
--HG--
extra : rebase_source : 703fde39432808cabd05b48aa40165e53ebc5ed1
nsAHttpTransaction::Available() obtained a bytecount from the abstract
transaction's input stream. If that stream was derived from a file://
it would create janky IO - so remove the interface.
Http2Push maintains a non-inherited interface which is used to check
the number of bytes it has internally buffered in memory.
MozReview-Commit-ID: IQHt8yGsqDE
--HG--
extra : rebase_source : 78dbd5cae35bc6cb1ce2f03192226cb85564298e
This patch prevents the following error:
AltDataOutputStreamChild::Close -> SendClose()
AltDataOutputStreamChild::Release -> Send__delete__()
AltDataOutputStreamParent::RecvClose() -> SendError()
AltDataOutputStreamParent::ActorDestroy -> mIPCOpen = false
AltDataOutputStreamChild::RecvError -> === Crash - object was deleted ===
We introduce the DeleteSelf message.
AltDataOutputStreamChild::Release -> SendDeleteSelf()
AltDataOutputStreamParent::RecvDeleteSelf -> mIPCOpen = false; SendDeleteSelf()
AltDataOutputStreamChild::RecvDeleteSelf -> Send__delete__()
The parent will not send any more messages after receiving the DeleteSelf message.
MozReview-Commit-ID: I9RQ5I7eSt9
--HG--
extra : rebase_source : 8f918d24595248149ebd3857e05e38dc5237059b
nsAHttpTransaction::Available() obtained a bytecount from the abstract
transaction's input stream. If that stream was derived from a file://
it would create janky IO - so remove the interface.
Http2Push maintains a non-inherited interface which is used to check
the number of bytes it has internally buffered in memory.
MozReview-Commit-ID: IQHt8yGsqDE
--HG--
extra : rebase_source : 6b3b210a8f6736887b5076c90621d678b038bcad
Removes references to now unused pref that was added in bug 868441 and removed in bugs 913807 and 1054572. It also removes some leftovers from http channel which have not been removed in those 2 bugs.
There's one redudant NS_ShouldCheckAppCache(nsIURI*, bool) is not used
anymore. Also we remove the extra usePrivateBrowsing argument, since we
can get this information from nsIPrincipal.
The blocking transactions should be dispatched before other transactions. So, this patch aims to put those transactions in front of the pending queue.
Moreover, also give the rest available connections to background tab when processing pendingQ for all entries.
mRacingNetAndCache used to be set in TriggerNetwork, when the network was triggered before the cache callbacks had been called, but this could also happen when we bypassed the cache.
MozReview-Commit-ID: 4CklwPVRGar
--HG--
extra : rebase_source : 47a604e25ce879b929dbb2eba7bca36e371845ae
This change makes the code a little cleaner and reduces the number of
places we call PR_GetCurrentThread, which is important for Quantum DOM
scheduling work.
The conversion was largely automatic, via:
find netwerk/ -name \*.cpp | \
xargs sed -i -e 's/MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread[^;]*/MOZ_ASSERT(OnSocketThread(), "not on socket thread")/'
and related invocations, with a few manual tweaks at the end.
Change mozilla::Smprintf and friends to return a UniquePtr, rather than
relying on manual memory management. (Though after this patch there are
still a handful of spots needing SmprintfFree.)
MozReview-Commit-ID: COa4nzIX5qa
--HG--
extra : rebase_source : ab4a11b4d2e758099bd0794d5c25d799a7e42680
This implements a plaintext reading of RFC 6797, which says to only consider the
first, however it slightly conflicts with RFC 7230, which says that sending
multiple headers which can't be merged is illegal (except for a specific
whitelist which HSTS isn't in). Chrome also implements HSTS using RFC 6797's
description of the parsing algorithm.
r=mcmanus,keeler
MozReview-Commit-ID: E06uIk2IcEK
--HG--
extra : rebase_source : 4a67f067d2953d4b30c1019a61bbfc7073e55b3d
clang's -Wcomma warning warns about suspicious use of the comma operator such as between two statements.
netwerk/protocol/http/Http2Stream.cpp:436:59 [-Wcomma] possible misuse of comma operator here
MozReview-Commit-ID: AsmNPTjKlYB
--HG--
extra : rebase_source : f25e62c3ac95b2b2cc412f82a8282591371f4925
extra : source : 9a1518b310c517ea81e78421c1479cfa14c8b17a
StringBundle caches bundles, so when language chain changes we should
flush the cache to enable new strings to be loaded.
This also affects localized prefs like intl.accept_languages.
Then in HttpHandler we have to mark the value as dirty so that next
time it's called it actually recalculates using flushed string bundle
with the new locale.
MozReview-Commit-ID: DKWEDUli4yH
--HG--
extra : rebase_source : 75ecc4204deca066d7492d1494492a91685f36be