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

Commit a3809b34 authored by Ben Murdoch's avatar Ben Murdoch Committed by Android (Google) Code Review
Browse files

Merge "Relax form autocomplete conditions"

parents 67fe0573 2376f825
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -422,9 +422,9 @@ class BrowserFrame extends Handler {
            final WebHistoryItem h = mCallbackProxy.getBackForwardList()
                    .getCurrentItem();
            if (h != null) {
                String currentUrl = h.getUrl();
                if (currentUrl != null) {
                    mDatabase.setFormData(currentUrl, data);
                String url = WebTextView.urlForAutoCompleteData(h.getUrl());
                if (url != null) {
                    mDatabase.setFormData(url, data);
                }
            }
        }
+15 −0
Original line number Diff line number Diff line
@@ -60,6 +60,8 @@ import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;

import junit.framework.Assert;
@@ -1044,6 +1046,7 @@ import junit.framework.Assert;
                break;
        }
        setHint(null);
        setThreshold(1);
        if (single) {
            mWebView.requestLabel(mWebView.nativeFocusCandidateFramePointer(),
                    mNodePointer);
@@ -1077,4 +1080,16 @@ import junit.framework.Assert;
    /* package */ void setAutoFillProfileIsSet(boolean autoFillProfileIsSet) {
        mAutoFillProfileIsSet = autoFillProfileIsSet;
    }

    static String urlForAutoCompleteData(String urlString) {
        // Remove any fragment or query string.
        URL url = null;
        try {
            url = new URL(urlString);
        } catch (MalformedURLException e) {
            Log.e(LOGTAG, "Unable to parse URL "+url);
        }

        return url != null ? url.getProtocol() + "://" + url.getHost() + url.getPath() : null;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -4826,7 +4826,7 @@ public class WebView extends AbsoluteLayout
        public RequestFormData(String name, String url, Message msg,
                boolean autoFillable, boolean autoComplete) {
            mName = name;
            mUrl = url;
            mUrl = WebTextView.urlForAutoCompleteData(url);
            mUpdateMessage = msg;
            mAutoFillable = autoFillable;
            mAutoComplete = autoComplete;