summaryrefslogtreecommitdiff
path: root/autofill-parser/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'autofill-parser/src/main/java')
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt2
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt4
-rw-r--r--autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt8
3 files changed, 10 insertions, 4 deletions
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
index 6a8e16f3..badaabcb 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillFormParser.kt
@@ -116,7 +116,7 @@ private class AutofillFormParser(
if (trustedBrowserInfo?.multiOriginMethod == BrowserMultiOriginMethod.WebView) {
FormField(node, fieldIndex, true, inheritedWebOrigin)
} else {
- check(inheritedWebOrigin == null)
+ check(inheritedWebOrigin == null) { "'inheritedWebOrigin' should be null here" }
FormField(node, fieldIndex, false)
}
if (field.relevantField) {
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
index 97419048..c7bd99fc 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillScenario.kt
@@ -105,7 +105,9 @@ public sealed class AutofillScenario<out T : Any> {
val genericPassword = mutableListOf<T>()
fun build(): AutofillScenario<T> {
- require(genericPassword.isEmpty() || (currentPassword.isEmpty() && newPassword.isEmpty()))
+ require(genericPassword.isEmpty() || (currentPassword.isEmpty() && newPassword.isEmpty())) {
+ "Password requirements failed."
+ }
return if (currentPassword.isNotEmpty() || newPassword.isNotEmpty()) {
ClassifiedAutofillScenario(
username = username,
diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt
index 0a75f078..04e8d98c 100644
--- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt
+++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategyDsl.kt
@@ -357,13 +357,17 @@ private constructor(
logcat { "$name: Matched $type" }
when (type) {
FillableFieldType.Username -> {
- check(matchResult.size == 1 && scenarioBuilder.username == null)
+ check(matchResult.size == 1 && scenarioBuilder.username == null) {
+ "Scenario has existing username or too many matches"
+ }
scenarioBuilder.username = matchResult.single()
// Hidden username fields should be saved but not filled.
scenarioBuilder.fillUsername = scenarioBuilder.username!!.isVisible == true
}
FillableFieldType.Otp -> {
- check(matchResult.size == 1 && scenarioBuilder.otp == null)
+ check(matchResult.size == 1 && scenarioBuilder.otp == null) {
+ "Scenario has existing OTP or too many matches"
+ }
scenarioBuilder.otp = matchResult.single()
}
FillableFieldType.CurrentPassword -> scenarioBuilder.currentPassword.addAll(matchResult)