• Emily Stark's avatar
    Preserve cert error code instead of transforming to ERR_INSECURE_RESPONSE · 03607654
    Emily Stark authored
    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: default avatarMatt Falkenhagen <falken@chromium.org>
    Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#520850}
    03607654
navigation_handle_impl_browsertest.cc 83.3 KB