Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • aguestuser/android-components
  • sysrqb/android-components
  • acat/android-components
  • gk/android-components
  • gaba/android-components
  • boklm/android-components
  • ma1/android-components
  • morgan/android-components
  • t-m-w/android-components
  • cypherpunks1/android-components
  • dan/android-components
11 results
Show changes
Commits on Source (12)
Showing
with 76 additions and 32 deletions
...@@ -106,7 +106,13 @@ subprojects { ...@@ -106,7 +106,13 @@ subprojects {
rename { 'manifest.json' } rename { 'manifest.json' }
into extDir into extDir
def values = ['version': rootProject.ext.config.componentsVersion + "." + new Date().format('MMddHHmmss')] def systemEnvBuildDate = System.getenv('MOZ_BUILD_DATE')
// MOZ_BUILD_DATE is in the YYYYMMDDHHMMSS format. Thus, we only use a
// substring of it if it is available.
def values = ['version': rootProject.ext.config.componentsVersion + "." +
(systemEnvBuildDate != null ?
systemEnvBuildDate.substring(4) :
new Date().format('MMddHHmmss'))]
inputs.properties(values) inputs.properties(values)
expand(values) expand(values)
} }
......
...@@ -634,6 +634,22 @@ class GeckoEngine( ...@@ -634,6 +634,22 @@ class GeckoEngine(
override var enterpriseRootsEnabled: Boolean override var enterpriseRootsEnabled: Boolean
get() = runtime.settings.enterpriseRootsEnabled get() = runtime.settings.enterpriseRootsEnabled
set(value) { runtime.settings.enterpriseRootsEnabled = value } set(value) { runtime.settings.enterpriseRootsEnabled = value }
override var torSecurityLevel: Int
get() = runtime.settings.torSecurityLevel
set(value) {
value.let {
runtime.settings.torSecurityLevel = it
}
}
override var spoofEnglish: Boolean
get() = runtime.settings.spoofEnglish
set(value) {
value.let {
runtime.settings.spoofEnglish = it
localeUpdater.updateValue()
}
}
}.apply { }.apply {
defaultSettings?.let { defaultSettings?.let {
this.javascriptEnabled = it.javascriptEnabled this.javascriptEnabled = it.javascriptEnabled
...@@ -652,6 +668,8 @@ class GeckoEngine( ...@@ -652,6 +668,8 @@ class GeckoEngine(
this.clearColor = it.clearColor this.clearColor = it.clearColor
this.loginAutofillEnabled = it.loginAutofillEnabled this.loginAutofillEnabled = it.loginAutofillEnabled
this.enterpriseRootsEnabled = it.enterpriseRootsEnabled this.enterpriseRootsEnabled = it.enterpriseRootsEnabled
this.torSecurityLevel = it.torSecurityLevel
this.spoofEnglish = it.spoofEnglish
} }
} }
......
...@@ -88,6 +88,7 @@ private fun Request.toWebRequest(): WebRequest = WebRequest.Builder(url) ...@@ -88,6 +88,7 @@ private fun Request.toWebRequest(): WebRequest = WebRequest.Builder(url)
.addHeadersFrom(this) .addHeadersFrom(this)
.addBodyFrom(this) .addBodyFrom(this)
.cacheMode(if (useCaches) CACHE_MODE_DEFAULT else CACHE_MODE_RELOAD) .cacheMode(if (useCaches) CACHE_MODE_DEFAULT else CACHE_MODE_RELOAD)
.origin(origin)
.build() .build()
private fun WebRequest.Builder.addHeadersFrom(request: Request): WebRequest.Builder { private fun WebRequest.Builder.addHeadersFrom(request: Request): WebRequest.Builder {
......
...@@ -52,7 +52,8 @@ class HttpIconLoader( ...@@ -52,7 +52,8 @@ class HttpIconLoader(
connectTimeout = Pair(CONNECT_TIMEOUT, TimeUnit.SECONDS), connectTimeout = Pair(CONNECT_TIMEOUT, TimeUnit.SECONDS),
readTimeout = Pair(READ_TIMEOUT, TimeUnit.SECONDS), readTimeout = Pair(READ_TIMEOUT, TimeUnit.SECONDS),
redirect = Request.Redirect.FOLLOW, redirect = Request.Redirect.FOLLOW,
useCaches = true) useCaches = true,
origin = request.url)
return try { return try {
val response = httpClient.fetch(downloadRequest) val response = httpClient.fetch(downloadRequest)
......
...@@ -9,7 +9,6 @@ import androidx.annotation.ColorRes ...@@ -9,7 +9,6 @@ import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import mozilla.components.browser.menu.item.BackPressMenuItem import mozilla.components.browser.menu.item.BackPressMenuItem
import mozilla.components.browser.menu.item.BrowserMenuDivider import mozilla.components.browser.menu.item.BrowserMenuDivider
import mozilla.components.browser.menu.item.BrowserMenuImageText
import mozilla.components.browser.menu.item.NO_ID import mozilla.components.browser.menu.item.NO_ID
import mozilla.components.browser.menu.item.ParentBrowserMenuItem import mozilla.components.browser.menu.item.ParentBrowserMenuItem
import mozilla.components.browser.menu.item.WebExtensionBrowserMenuItem import mozilla.components.browser.menu.item.WebExtensionBrowserMenuItem
...@@ -96,20 +95,10 @@ class WebExtensionBrowserMenuBuilder( ...@@ -96,20 +95,10 @@ class WebExtensionBrowserMenuBuilder(
iconTintColorResource = style.webExtIconTintColorResource iconTintColorResource = style.webExtIconTintColorResource
) )
val addonsManagerMenuItem = BrowserMenuImageText(
label = context.getString(R.string.mozac_browser_menu_addons_manager),
imageResource = style.addonsManagerMenuItemDrawableRes,
iconTintColorResource = style.webExtIconTintColorResource
) {
onAddonsManagerTapped.invoke()
}
val webExtSubMenuItems = if (appendExtensionSubMenuAtStart) { val webExtSubMenuItems = if (appendExtensionSubMenuAtStart) {
listOf(backPressMenuItem) + BrowserMenuDivider() + listOf(backPressMenuItem) + BrowserMenuDivider() +
filteredExtensionMenuItems + filteredExtensionMenuItems
BrowserMenuDivider() + addonsManagerMenuItem
} else { } else {
listOf(addonsManagerMenuItem) + BrowserMenuDivider() +
filteredExtensionMenuItems + filteredExtensionMenuItems +
BrowserMenuDivider() + backPressMenuItem BrowserMenuDivider() + backPressMenuItem
} }
...@@ -125,25 +114,21 @@ class WebExtensionBrowserMenuBuilder( ...@@ -125,25 +114,21 @@ class WebExtensionBrowserMenuBuilder(
endOfMenuAlwaysVisible = endOfMenuAlwaysVisible endOfMenuAlwaysVisible = endOfMenuAlwaysVisible
) )
} else { } else {
BrowserMenuImageText( null
label = context.getString(R.string.mozac_browser_menu_addons),
imageResource = style.addonsManagerMenuItemDrawableRes,
iconTintColorResource = style.webExtIconTintColorResource
) {
onAddonsManagerTapped.invoke()
}
} }
val mainMenuIndex = items.indexOfFirst { browserMenuItem -> val mainMenuIndex = items.indexOfFirst { browserMenuItem ->
(browserMenuItem as? WebExtensionPlaceholderMenuItem)?.id == (browserMenuItem as? WebExtensionPlaceholderMenuItem)?.id ==
WebExtensionPlaceholderMenuItem.MAIN_EXTENSIONS_MENU_ID WebExtensionPlaceholderMenuItem.MAIN_EXTENSIONS_MENU_ID
} }
return if (mainMenuIndex != -1) { return if (mainMenuIndex != -1 && addonsMenuItem != null) {
items[mainMenuIndex] = addonsMenuItem items[mainMenuIndex] = addonsMenuItem
items items
// if we do not have a placeholder we should add the extension submenu at top or bottom // if we do not have a placeholder we should add the extension submenu at top or bottom
} else { } else {
if (appendExtensionSubMenuAtStart) { if (addonsMenuItem == null) {
items
} else if (appendExtensionSubMenuAtStart) {
listOf(addonsMenuItem) + items listOf(addonsMenuItem) + items
} else { } else {
items + addonsMenuItem items + addonsMenuItem
......
...@@ -499,6 +499,7 @@ class DisplayToolbar internal constructor( ...@@ -499,6 +499,7 @@ class DisplayToolbar internal constructor(
@ColorInt val color = when (siteSecurity) { @ColorInt val color = when (siteSecurity) {
Toolbar.SiteSecurity.INSECURE -> colors.securityIconInsecure Toolbar.SiteSecurity.INSECURE -> colors.securityIconInsecure
Toolbar.SiteSecurity.SECURE -> colors.securityIconSecure Toolbar.SiteSecurity.SECURE -> colors.securityIconSecure
Toolbar.SiteSecurity.ONION -> colors.securityIconSecure
} }
if (color == Color.TRANSPARENT) { if (color == Color.TRANSPARENT) {
views.securityIndicator.clearColorFilter() views.securityIndicator.clearColorFilter()
......
...@@ -43,6 +43,11 @@ internal class SiteSecurityIconView @JvmOverloads constructor( ...@@ -43,6 +43,11 @@ internal class SiteSecurityIconView @JvmOverloads constructor(
View.mergeDrawableStates(drawableState, intArrayOf(R.attr.state_site_secure)) View.mergeDrawableStates(drawableState, intArrayOf(R.attr.state_site_secure))
drawableState drawableState
} }
SiteSecurity.ONION -> {
val drawableState = super.onCreateDrawableState(extraSpace + 1)
View.mergeDrawableStates(drawableState, intArrayOf(R.attr.state_site_onion))
drawableState
}
} }
} }
} }
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ac="http://schemas.android.com/apk/res-auto"> <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ac="http://schemas.android.com/apk/res-auto">
<item
android:drawable="@drawable/mozac_ic_onion"
ac:state_site_onion="true" />
<item <item
android:drawable="@drawable/mozac_ic_lock" android:drawable="@drawable/mozac_ic_lock"
ac:state_site_secure="true" /> ac:state_site_secure="true" />
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
<attr name="state_site_secure" format="boolean"/> <attr name="state_site_secure" format="boolean"/>
</declare-styleable> </declare-styleable>
<declare-styleable name="BrowserToolbarSiteOnionState">
<attr name="state_site_onion" format="boolean"/>
</declare-styleable>
<declare-styleable name="ActionContainer"> <declare-styleable name="ActionContainer">
<attr name="actionContainerItemSize" format="dimension" /> <attr name="actionContainerItemSize" format="dimension" />
</declare-styleable> </declare-styleable>
......
...@@ -9,6 +9,7 @@ import android.graphics.Bitmap ...@@ -9,6 +9,7 @@ import android.graphics.Bitmap
import androidx.annotation.CallSuper import androidx.annotation.CallSuper
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy.ACCEPT_ALL import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy.ACCEPT_ALL
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy.ACCEPT_NON_TRACKERS import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy.ACCEPT_NON_TRACKERS
import mozilla.components.concept.engine.EngineSession.TrackingProtectionPolicy.CookiePolicy.ACCEPT_ONLY_FIRST_PARTY
import mozilla.components.concept.engine.content.blocking.Tracker import mozilla.components.concept.engine.content.blocking.Tracker
import mozilla.components.concept.engine.history.HistoryItem import mozilla.components.concept.engine.history.HistoryItem
import mozilla.components.concept.engine.manifest.WebAppManifest import mozilla.components.concept.engine.manifest.WebAppManifest
...@@ -384,7 +385,9 @@ abstract class EngineSession( ...@@ -384,7 +385,9 @@ abstract class EngineSession(
companion object { companion object {
fun none() = TrackingProtectionPolicy( fun none() = TrackingProtectionPolicy(
trackingCategories = arrayOf(TrackingCategory.NONE), trackingCategories = arrayOf(TrackingCategory.NONE),
cookiePolicy = ACCEPT_ALL useForPrivateSessions = false,
useForRegularSessions = false,
cookiePolicy = ACCEPT_ONLY_FIRST_PARTY
) )
/** /**
......
...@@ -184,6 +184,13 @@ abstract class Settings { ...@@ -184,6 +184,13 @@ abstract class Settings {
* Setting to control whether enterprise root certs are enabled. * Setting to control whether enterprise root certs are enabled.
*/ */
open var enterpriseRootsEnabled: Boolean by UnsupportedSetting() open var enterpriseRootsEnabled: Boolean by UnsupportedSetting()
/**
* Setting to control the current security level
*/
open var torSecurityLevel: Int by UnsupportedSetting()
open var spoofEnglish: Boolean by UnsupportedSetting()
} }
/** /**
...@@ -220,7 +227,9 @@ data class DefaultSettings( ...@@ -220,7 +227,9 @@ data class DefaultSettings(
override var forceUserScalableContent: Boolean = false, override var forceUserScalableContent: Boolean = false,
override var loginAutofillEnabled: Boolean = false, override var loginAutofillEnabled: Boolean = false,
override var clearColor: Int? = null, override var clearColor: Int? = null,
override var enterpriseRootsEnabled: Boolean = false override var enterpriseRootsEnabled: Boolean = false,
override var torSecurityLevel: Int = 4,
override var spoofEnglish: Boolean = false
) : Settings() ) : Settings()
class UnsupportedSetting<T> { class UnsupportedSetting<T> {
......
...@@ -48,7 +48,8 @@ data class Request( ...@@ -48,7 +48,8 @@ data class Request(
val redirect: Redirect = Redirect.FOLLOW, val redirect: Redirect = Redirect.FOLLOW,
val cookiePolicy: CookiePolicy = CookiePolicy.INCLUDE, val cookiePolicy: CookiePolicy = CookiePolicy.INCLUDE,
val useCaches: Boolean = true, val useCaches: Boolean = true,
val private: Boolean = false val private: Boolean = false,
val origin: String? = null
) { ) {
/** /**
* A [Body] to be send with the [Request]. * A [Body] to be send with the [Request].
......
...@@ -414,6 +414,7 @@ interface Toolbar { ...@@ -414,6 +414,7 @@ interface Toolbar {
enum class SiteSecurity { enum class SiteSecurity {
INSECURE, INSECURE,
SECURE, SECURE,
ONION,
} }
/** /**
......
...@@ -58,7 +58,7 @@ internal const val PAGE_SIZE = 50 ...@@ -58,7 +58,7 @@ internal const val PAGE_SIZE = 50
* cache is being used by default * cache is being used by default
*/ */
@Suppress("LongParameterList") @Suppress("LongParameterList")
class AddonCollectionProvider( open class AddonCollectionProvider(
private val context: Context, private val context: Context,
private val client: Client, private val client: Client,
private val serverURL: String = DEFAULT_SERVER_URL, private val serverURL: String = DEFAULT_SERVER_URL,
...@@ -173,7 +173,7 @@ class AddonCollectionProvider( ...@@ -173,7 +173,7 @@ class AddonCollectionProvider(
* a connectivity problem or a timeout. * a connectivity problem or a timeout.
*/ */
@Throws(IOException::class) @Throws(IOException::class)
suspend fun getAddonIconBitmap(addon: Addon): Bitmap? { open suspend fun getAddonIconBitmap(addon: Addon): Bitmap? {
var bitmap: Bitmap? = null var bitmap: Bitmap? = null
if (addon.iconUrl != "") { if (addon.iconUrl != "") {
client.fetch( client.fetch(
...@@ -191,7 +191,7 @@ class AddonCollectionProvider( ...@@ -191,7 +191,7 @@ class AddonCollectionProvider(
} }
@VisibleForTesting @VisibleForTesting
internal fun writeToDiskCache(collectionResponse: String, language: String?) { protected fun writeToDiskCache(collectionResponse: String, language: String?) {
synchronized(diskCacheLock) { synchronized(diskCacheLock) {
getCacheFile(context, language, useFallbackFile = false).writeString { collectionResponse } getCacheFile(context, language, useFallbackFile = false).writeString { collectionResponse }
} }
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
/> />
<androidx.appcompat.widget.AppCompatCheckBox <androidx.appcompat.widget.AppCompatCheckBox
android:visibility="gone"
android:id="@+id/allow_in_private_browsing" android:id="@+id/allow_in_private_browsing"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -42,6 +42,7 @@ dependencies { ...@@ -42,6 +42,7 @@ dependencies {
implementation Dependencies.kotlin_stdlib implementation Dependencies.kotlin_stdlib
implementation Dependencies.kotlin_coroutines implementation Dependencies.kotlin_coroutines
implementation project(path: ':support-utils')
testImplementation project(':support-test') testImplementation project(':support-test')
testImplementation project(':support-test-libstate') testImplementation project(':support-test-libstate')
......
...@@ -100,7 +100,7 @@ class AppLinksFeature( ...@@ -100,7 +100,7 @@ class AppLinksFeature(
) )
} }
if (!tab.content.private || fragmentManager == null) { if (true || !tab.content.private || fragmentManager == null) {
doOpenApp() doOpenApp()
return return
} }
......
...@@ -21,6 +21,7 @@ import mozilla.components.support.ktx.android.net.isHttpOrHttps ...@@ -21,6 +21,7 @@ import mozilla.components.support.ktx.android.net.isHttpOrHttps
import java.lang.Exception import java.lang.Exception
import java.lang.NullPointerException import java.lang.NullPointerException
import java.net.URISyntaxException import java.net.URISyntaxException
import mozilla.components.support.utils.TorUtils
private const val EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url" private const val EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url"
private const val MARKET_INTENT_URI_PACKAGE_PREFIX = "market://details?id=" private const val MARKET_INTENT_URI_PACKAGE_PREFIX = "market://details?id="
...@@ -211,7 +212,7 @@ class AppLinksUseCases( ...@@ -211,7 +212,7 @@ class AppLinksUseCases(
if (launchInNewTask) { if (launchInNewTask) {
it.flags = it.flags or Intent.FLAG_ACTIVITY_NEW_TASK it.flags = it.flags or Intent.FLAG_ACTIVITY_NEW_TASK
} }
context.startActivity(it) TorUtils.startActivityPrompt(context, it)
} catch (e: Exception) { } catch (e: Exception) {
when (e) { when (e) {
is ActivityNotFoundException, is SecurityException, is NullPointerException -> { is ActivityNotFoundException, is SecurityException, is NullPointerException -> {
......
...@@ -23,6 +23,7 @@ import mozilla.components.support.ktx.android.content.addContact ...@@ -23,6 +23,7 @@ import mozilla.components.support.ktx.android.content.addContact
import mozilla.components.support.ktx.android.content.share import mozilla.components.support.ktx.android.content.share
import mozilla.components.support.ktx.kotlin.stripMailToProtocol import mozilla.components.support.ktx.kotlin.stripMailToProtocol
import mozilla.components.support.ktx.kotlin.takeOrReplace import mozilla.components.support.ktx.kotlin.takeOrReplace
import mozilla.components.support.utils.TorUtils
/** /**
* A candidate for an item to be displayed in the context menu. * A candidate for an item to be displayed in the context menu.
...@@ -358,7 +359,7 @@ data class ContextMenuCandidate( ...@@ -358,7 +359,7 @@ data class ContextMenuCandidate(
context.getString(R.string.mozac_feature_contextmenu_share_link) context.getString(R.string.mozac_feature_contextmenu_share_link)
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(shareIntent) TorUtils.startActivityPrompt(context, shareIntent)
} }
) )
......
...@@ -21,6 +21,8 @@ android { ...@@ -21,6 +21,8 @@ android {
arg("room.schemaLocation", "$projectDir/schemas".toString()) arg("room.schemaLocation", "$projectDir/schemas".toString())
} }
} }
buildConfigField("boolean", "ANDROID_DOWNLOADS_INTEGRATION", "false")
} }
buildTypes { buildTypes {
......