Preserve cert error code instead of transforming to ERR_INSECURE_RESPONSE
When denying a request with a certificate error, we've historically cancelled it with a net error code of net::ERR_INSECURE_RESPONSE in content/browser/ssl/ssl_error_handler.cc, instead of the actual error code that was encountered (e.g. net::ERR_CERT_DATE_INVALID). This is a little awkward for committed interstitials [1] because we won't be able to determine from the error code along whether an error page is for a certificate error, and there are places where we have only the error code available, not supplemental info like the SSLInfo or CertStatus. (See for example NetErrorHelperCore::ErrorPageInfo.) This comes up in other contexts as well where we only have the net error code available (see bug for details). Along the way, this change fixes a bug in ServiceWorkerScriptURLLoader. This loader was using response_head.cert_status to detect certificate errors, but that field was not being populated by URLLoader (and was only populated by ResourceLoader when devtools was open). So this CL populates cert_status unconditionally to avoid this problem. The corresponding test was buggily passing: it was expecting ERR_INSECURE_RESPONSE due to a cert error, but was actually producing ERR_INSECURE_RESPONSE due to an unrelated error (unexpected mime type). Converting certificate errors to use the more specific certificate error codes instead of ERR_INSECURE_RESPONSE should prevent this test from regressing again. Finally, fixing the Service Worker certificate checking revealed a number of other SW tests which were expecting certificate errors to be ignored via --ignore-certificate-errors, which broke once the SW bug had been fixed. This CL adds --ignore-certificate-errors support to the network service, so that those tests pass again. [1] https://docs.google.com/document/d/1rEBpw5V-Nn1UIi8CIFa5ZZvwlR08SkY3CogvWE2UMFs/edit Bug: 789720,789682 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: I963b172dcfa400ef256e89c7c94d3f91b8bc5697 Reviewed-on: https://chromium-review.googlesource.com/797536 Commit-Queue: Emily Stark <estark@chromium.org> Reviewed-by:Matt Falkenhagen <falken@chromium.org> Reviewed-by:
John Abd-El-Malek <jam@chromium.org> Cr-Commit-Position: refs/heads/master@{#520850}
Showing
Please register or sign in to comment