Skip to content

Commit 6eb06df

Browse files
daxmobileCDRussell
andauthored
Update content scope scripts to version 11.31.0 (#6858)
Task/Issue URL: https://app.asana.com/0/488551667048375/1211493773997168/f ----- - Automated content scope scripts dependency update This PR updates the content scope scripts dependency to the latest available version and copies the necessary files. Tests will only run if something has changed in the `node_modules/@duckduckgo/content-scope-scripts` folder. If only the package version has changed, there is no need to run the tests. If tests have failed, see https://app.asana.com/0/1202561462274611/1203986899650836/f for further information on what to do next. _`content-scope-scripts` folder update_ - [ ] All tests must pass - [ ] Privacy tests must pass _Only `content-scope-scripts` package update_ - [ ] All tests must pass - [ ] Privacy tests do not need to run --------- Co-authored-by: daxmobile <[email protected]> Co-authored-by: Craig Russell <[email protected]>
1 parent e65e1d1 commit 6eb06df

File tree

8 files changed

+9829
-4516
lines changed

8 files changed

+9829
-4516
lines changed

autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/importing/gpm/webflow/PasswordImporterCssScriptLoader.kt

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import com.duckduckgo.autofill.impl.importing.gpm.feature.AutofillImportPassword
2020
import com.duckduckgo.common.utils.DispatcherProvider
2121
import com.duckduckgo.di.scopes.FragmentScope
2222
import com.squareup.anvil.annotations.ContributesBinding
23+
import kotlinx.coroutines.withContext
2324
import java.io.BufferedReader
2425
import javax.inject.Inject
25-
import kotlinx.coroutines.withContext
2626

2727
interface PasswordImporterScriptLoader {
2828
suspend fun getScript(): String
@@ -33,43 +33,38 @@ class PasswordImporterCssScriptLoader @Inject constructor(
3333
private val dispatchers: DispatcherProvider,
3434
private val configStore: AutofillImportPasswordConfigStore,
3535
) : PasswordImporterScriptLoader {
36-
3736
private lateinit var contentScopeJS: String
3837

39-
override suspend fun getScript(): String {
40-
return withContext(dispatchers.io()) {
38+
override suspend fun getScript(): String =
39+
withContext(dispatchers.io()) {
4140
getContentScopeJS()
4241
.replace(CONTENT_SCOPE_PLACEHOLDER, getContentScopeJson(loadSettingsJson()))
4342
.replace(USER_UNPROTECTED_DOMAINS_PLACEHOLDER, getUnprotectedDomainsJson())
4443
.replace(USER_PREFERENCES_PLACEHOLDER, getUserPreferencesJson())
4544
}
46-
}
4745

4846
/**
4947
* This enables the password import hints feature in C-S-S.
5048
* These settings are for enabling it; the check for whether it should be enabled or not is done elsewhere.
5149
*/
52-
private fun getContentScopeJson(settingsJson: String): String {
53-
return """{
50+
private fun getContentScopeJson(settingsJson: String): String =
51+
"""{
5452
"features":{
55-
"autofillPasswordImport" : {
53+
"autofillImport" : {
5654
"state": "enabled",
5755
"exceptions": [],
5856
"settings": $settingsJson
5957
}
6058
},
6159
"unprotectedTemporary":[]
6260
}
63-
61+
6462
""".trimMargin()
65-
}
6663

67-
private suspend fun loadSettingsJson(): String {
68-
return configStore.getConfig().javascriptConfigGooglePasswords
69-
}
64+
private suspend fun loadSettingsJson(): String = configStore.getConfig().javascriptConfigGooglePasswords
7065

71-
private fun getUserPreferencesJson(): String {
72-
return """
66+
private fun getUserPreferencesJson(): String =
67+
"""
7368
{
7469
"platform":{
7570
"name":"android"
@@ -78,13 +73,12 @@ class PasswordImporterCssScriptLoader @Inject constructor(
7873
"javascriptInterface": ''
7974
}
8075
""".trimMargin()
81-
}
8276

8377
private fun getUnprotectedDomainsJson(): String = "[]"
8478

8579
private fun getContentScopeJS(): String {
8680
if (!this::contentScopeJS.isInitialized) {
87-
contentScopeJS = loadJs("autofillPasswordImport.js")
81+
contentScopeJS = loadJs("autofillImport.js")
8882
}
8983
return contentScopeJS
9084
}
@@ -97,7 +91,9 @@ class PasswordImporterCssScriptLoader @Inject constructor(
9791

9892
private fun loadJs(resourceName: String): String = readResource(resourceName).use { it?.readText() }.orEmpty()
9993

100-
private fun readResource(resourceName: String): BufferedReader? {
101-
return javaClass.classLoader?.getResource(resourceName)?.openStream()?.bufferedReader()
102-
}
94+
private fun readResource(resourceName: String): BufferedReader? =
95+
javaClass.classLoader
96+
?.getResource(resourceName)
97+
?.openStream()
98+
?.bufferedReader()
10399
}

node_modules/@duckduckgo/content-scope-scripts/build/android/adsjsContentScope.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@duckduckgo/content-scope-scripts/build/android/autofillImport.js

Lines changed: 9751 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@duckduckgo/content-scope-scripts/build/android/autofillPasswordImport.js

Lines changed: 0 additions & 4459 deletions
This file was deleted.

node_modules/@duckduckgo/content-scope-scripts/build/android/brokerProtection.js

Lines changed: 55 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@duckduckgo/content-scope-scripts/build/android/contentScope.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dependencies": {
1616
"@duckduckgo/autoconsent": "^14.19.0",
1717
"@duckduckgo/autofill": "github:duckduckgo/duckduckgo-autofill#18.3.1",
18-
"@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#11.30.0",
18+
"@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#11.31.0",
1919
"@duckduckgo/privacy-dashboard": "github:duckduckgo/privacy-dashboard#9.0.0",
2020
"@duckduckgo/privacy-reference-tests": "github:duckduckgo/privacy-reference-tests#1758095627"
2121
}

0 commit comments

Comments
 (0)