зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1726209 - Add null check when retreiving UUID of a Node r=geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D123274
This commit is contained in:
Родитель
bc233d2be7
Коммит
2942d2a222
|
@ -237,6 +237,24 @@ class AutofillDelegateTest : BaseSessionTest() {
|
|||
}
|
||||
}
|
||||
|
||||
@Test fun autofillUnknownValue() {
|
||||
// Test parts of the Oreo auto-fill API; there is another autofill test in
|
||||
// SessionAccessibility for a11y auto-fill support.
|
||||
mainSession.loadTestPath(FORMS_HTML_PATH)
|
||||
// Wait for the auto-fill nodes to populate.
|
||||
sessionRule.waitUntilCalled(object : Autofill.Delegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onAutofill(session: GeckoSession,
|
||||
notification: Int,
|
||||
node: Autofill.Node?) {
|
||||
}
|
||||
})
|
||||
|
||||
val autofillValues = SparseArray<CharSequence>()
|
||||
autofillValues.append(-1, "lobster")
|
||||
mainSession.autofill(autofillValues)
|
||||
}
|
||||
|
||||
private fun countAutofillNodes(cond: (Autofill.Node) -> Boolean =
|
||||
{ it.inputType != Autofill.InputType.NONE },
|
||||
root: Autofill.Node? = null): Int {
|
||||
|
|
|
@ -290,10 +290,6 @@ public class Autofill {
|
|||
return mRoot;
|
||||
}
|
||||
|
||||
/* package */ String getUuid(final int id) {
|
||||
return mNodes.get(id).getUuid();
|
||||
}
|
||||
|
||||
/* package */ int getIdFromUuid(final String uuid) {
|
||||
final Integer id = mUuidToId.get(uuid);
|
||||
if (id != null) {
|
||||
|
@ -1103,8 +1099,10 @@ public class Autofill {
|
|||
response = new GeckoBundle(values.size() - i);
|
||||
callback = newCallback;
|
||||
}
|
||||
final String uuid = getAutofillSession().getUuid(id);
|
||||
response.putString(uuid, String.valueOf(value));
|
||||
final Node node = getAutofillSession().getNode(id);
|
||||
if (node != null) {
|
||||
response.putString(node.getUuid(), String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
if (callback != null) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче