Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf52c0ea authored by Steve Block's avatar Steve Block
Browse files

SSL-related cleanup in BrowserFrame and SslCertLookupTable

- Fix a comment in BrowserFrame.certificate()
- Simplify SslCertLookupTable by not storing 'deny' decisions.
  We only need to store 'allow' decisions, as we don't re-use 'deny' decisions.

No change in behaviour.

Bug: 5409251
Change-Id: I447cd1966fbb6c2dea8088b2e4c4e2de22405cb9
parent 270a3c80
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -471,8 +471,6 @@ class BrowserFrame extends Handler {

    /**
     * We have received an SSL certificate for the main top-level page.
     *
     * !!!Called from the network thread!!!
     */
    void certificate(SslCertificate certificate) {
        if (mIsMainFrame) {
@@ -1186,12 +1184,11 @@ class BrowserFrame extends Handler {
        SslErrorHandler handler = new SslErrorHandler() {
            @Override
            public void proceed() {
                SslCertLookupTable.getInstance().setIsAllowed(sslError, true);
                SslCertLookupTable.getInstance().setIsAllowed(sslError);
                nativeSslCertErrorProceed(handle);
            }
            @Override
            public void cancel() {
                SslCertLookupTable.getInstance().setIsAllowed(sslError, false);
                nativeSslCertErrorCancel(handle, certError);
            }
        };
+4 −3
Original line number Diff line number Diff line
@@ -25,7 +25,8 @@ import java.net.URL;
/**
 * Stores the user's decision of whether to allow or deny an invalid certificate.
 *
 * This class is not threadsafe. It is used only on the WebCore thread.
 * This class is not threadsafe. It is used only on the WebCore thread. Also, it
 * is used only by the Chromium HTTP stack.
 */
final class SslCertLookupTable {
    private static SslCertLookupTable sTable;
@@ -42,11 +43,11 @@ final class SslCertLookupTable {
        table = new Bundle();
    }

    public void setIsAllowed(SslError sslError, boolean allow) {
    public void setIsAllowed(SslError sslError) {
        // TODO: We should key on just the host. See http://b/5409251.
        String errorString = sslErrorToString(sslError);
        if (errorString != null) {
            table.putBoolean(errorString, allow);
            table.putBoolean(errorString, true);
        }
    }