Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Crash: java.lang.OutOfMemoryError - com.duckduckgo.autofill.impl.configuration.RealAutofillRuntimeConfigProvider.getRuntimeConfiguration #5433

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,19 @@ class RealAutofillRuntimeConfigProvider @Inject constructor(
)
val availableInputTypes = generateAvailableInputTypes(url)

return rawJs
.replace("// INJECT contentScope HERE", contentScope)
.replace("// INJECT userUnprotectedDomains HERE", userUnprotectedDomains)
.replace("// INJECT userPreferences HERE", userPreferences)
.replace("// INJECT availableInputTypes HERE", availableInputTypes)
return StringBuilder(rawJs).apply {
replacePlaceholder(this, TAG_INJECT_CONTENT_SCOPE, contentScope)
replacePlaceholder(this, TAG_INJECT_USER_UNPROTECTED_DOMAINS, userUnprotectedDomains)
replacePlaceholder(this, TAG_INJECT_USER_PREFERENCES, userPreferences)
replacePlaceholder(this, TAG_INJECT_AVAILABLE_INPUT_TYPES, availableInputTypes)
}.toString()
}

private fun replacePlaceholder(builder: StringBuilder, placeholder: String, replacement: String) {
val index = builder.indexOf(placeholder)
if (index != -1) {
builder.replace(index, index + placeholder.length, replacement)
}
}

private suspend fun generateAvailableInputTypes(url: String?): String {
Expand Down Expand Up @@ -139,4 +147,11 @@ class RealAutofillRuntimeConfigProvider @Inject constructor(
}

private fun determineIfEmailAvailable(): Boolean = emailManager.isSignedIn()

companion object {
private const val TAG_INJECT_CONTENT_SCOPE = "// INJECT contentScope HERE"
private const val TAG_INJECT_USER_UNPROTECTED_DOMAINS = "// INJECT userUnprotectedDomains HERE"
private const val TAG_INJECT_USER_PREFERENCES = "// INJECT userPreferences HERE"
private const val TAG_INJECT_AVAILABLE_INPUT_TYPES = "// INJECT availableInputTypes HERE"
}
}
Loading