Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trust Tokens: Give ERR_TRUST_TOKEN_OPERATION_CACHE_HIT more generic name
Trust Tokens is a new web feature that extends the fetch API to allow specifying executing certain cryptographic operations alongside outgoing requests: the requests gain new HTTP request headers bearing outbound cryptographic payloads, and the corresponding responses from servers usually contain corresponding cryptographic responses; the browser processes and strips the responses, updating local state. Sometimes, these operations' results can be cached: when we encounter a cached result from a previous operation, we fail the request with ERR_TRUST_TOKEN_OPERATION_CACHE_HIT. This is because we assume that the main reason for sending a request with an associated Trust Tokens operation is executing the Trust Tokens operation (rather than sending whatever's in the request body and obtaining whatever's in the response body), so the caller wouldn't want to incur the resource consumption caused by the request if the Trust Tokens operation's result is already stored locally. While failing a request with ERR_TRUST_TOKEN_OPERATION_CACHE_HIT follows the ResourceError code path in Blink and causes fetch() calls to reject, these requests: - do not trigger additional "request failed" error prints in the DevTools console (assuming that the caller catches the exception that the fetch Promise rejects with); and - show up as "cache hits" (black, in contrast to red errors) in the DevTools network panel. We're adding a new code path ("platform-provided trust tokens"; crbug.com/1130248) where we can have a Trust Tokens operation complete by calling out to a system service, instead of sending a HTTP request to a server. This is pretty similar to the existing "cache hit" case in that we discover we don't need to send anything to a server after all, so we bail early by "failing" the request (since it is messy to populate an empty "success" response) in this case, too. To make the error handling for Trust Tokens operations that are successfully fulfilled locally have the same developer-facing characteristics as cache hits (no console error; not a failure in the network panel), we want to achieve similar error handling. The easiest way to do this seemed to be making the existing net error more generic, to the effect of "we didn't need to send a request to execute the desired Trust Tokens operation, so there's no response to provide" and setting the new error code for both cache hits and locally fulfilled Trust Tokens operations. This CL renames the error code; a follow-up CL will update URLLoader to set this net error for locally fulfilled Trust Tokens operations in addition to, as currently, cache hits. R=mmenke Bug: 1154847 Change-Id: I33e80515c77f2f8e0fc442ccbe9cc98c9b693738 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568205 Reviewed-by: Matt Menke <mmenke@chromium.org> Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Reviewed-by: Jeremy Roman <jbroman@chromium.org> Auto-Submit: David Van Cleve <davidvc@chromium.org> Commit-Queue: Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#833371}
- Loading branch information