diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-20 04:02:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-20 04:02:43 +0000 |
commit | 8ef7f43d9d880ce1c7da687c3c0bf2caf44bcbcd (patch) | |
tree | 16a27151176f80644677f4007d17dbd5f4d0f204 /dom/security/nsHTTPSOnlyUtils.h | |
parent | Releasing progress-linux version 127.0-1~progress7.99u1. (diff) | |
download | firefox-8ef7f43d9d880ce1c7da687c3c0bf2caf44bcbcd.tar.xz firefox-8ef7f43d9d880ce1c7da687c3c0bf2caf44bcbcd.zip |
Merging upstream version 127.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/security/nsHTTPSOnlyUtils.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dom/security/nsHTTPSOnlyUtils.h b/dom/security/nsHTTPSOnlyUtils.h index 775fbf39e0..d582e62f36 100644 --- a/dom/security/nsHTTPSOnlyUtils.h +++ b/dom/security/nsHTTPSOnlyUtils.h @@ -176,6 +176,31 @@ class nsHTTPSOnlyUtils { */ static uint32_t GetStatusForSubresourceLoad(uint32_t aHttpsOnlyStatus); + /** + * When a downgrade is happening because of HTTPS-First, this function will + * update the load state for the new load accordingly. This includes + * information about the downgrade for later telemetry use. + * @param aDocumentLoadListener The calling document load listener. + * @param aLoadState The load state to be updated + */ + static void UpdateLoadStateAfterHTTPSFirstDowngrade( + mozilla::net::DocumentLoadListener* aDocumentLoadListener, + nsDocShellLoadState* aLoadState); + + /** + * When a load is successful, this should be called by the document load + * listener. In two cases, telemetry is then recorded: + * a) If downgrade data has been passed, the passed load is a successful + * downgrade, which means telemetry based on the downgrade data will be + * submitted. + * b) If the passed load info indicates that this load has been upgraded by + * HTTPS-First, this means the upgrade was successful, which will be + * recorded to telemetry. + */ + static void SubmitHTTPSFirstTelemetry( + nsCOMPtr<nsILoadInfo> const& aLoadInfo, + RefPtr<HTTPSFirstDowngradeData> const& aHttpsFirstDowngradeData); + private: /** * Checks if it can be ruled out that the error has something @@ -257,4 +282,17 @@ class TestHTTPAnswerRunnable final : public mozilla::Runnable, RefPtr<nsITimer> mTimer; }; +/** + * Data about a HTTPS-First downgrade used for Telemetry. We need to store this + * instead of directly submitting it when deciding to downgrade, because it is + * only interesting for us if the downgraded load is actually succesful. + */ +struct HTTPSFirstDowngradeData + : public mozilla::RefCounted<HTTPSFirstDowngradeData> { + MOZ_DECLARE_REFCOUNTED_TYPENAME(HTTPSFirstDowngradeData) + mozilla::TimeDuration downgradeTime; + bool isOnTimer = false; + bool isSchemeless = false; +}; + #endif /* nsHTTPSOnlyUtils_h___ */ |