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 {
rename { 'manifest.json' }
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)
expand(values)
}
......
......@@ -634,6 +634,22 @@ class GeckoEngine(
override var enterpriseRootsEnabled: Boolean
get() = runtime.settings.enterpriseRootsEnabled
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 {
defaultSettings?.let {
this.javascriptEnabled = it.javascriptEnabled
......@@ -652,6 +668,8 @@ class GeckoEngine(
this.clearColor = it.clearColor
this.loginAutofillEnabled = it.loginAutofillEnabled
this.enterpriseRootsEnabled = it.enterpriseRootsEnabled
this.torSecurityLevel = it.torSecurityLevel
this.spoofEnglish = it.spoofEnglish
}
}
......
......@@ -88,6 +88,7 @@ private fun Request.toWebRequest(): WebRequest = WebRequest.Builder(url)
.addHeadersFrom(this)
.addBodyFrom(this)
.cacheMode(if (useCaches) CACHE_MODE_DEFAULT else CACHE_MODE_RELOAD)
.origin(origin)
.build()
private fun WebRequest.Builder.addHeadersFrom(request: Request): WebRequest.Builder {
......
......@@ -52,7 +52,8 @@ class HttpIconLoader(
connectTimeout = Pair(CONNECT_TIMEOUT, TimeUnit.SECONDS),
readTimeout = Pair(READ_TIMEOUT, TimeUnit.SECONDS),
redirect = Request.Redirect.FOLLOW,
useCaches = true)
useCaches = true,
origin = request.url)
return try {
val response = httpClient.fetch(downloadRequest)
......
......@@ -9,7 +9,6 @@ import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import mozilla.components.browser.menu.item.BackPressMenuItem
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.ParentBrowserMenuItem
import mozilla.components.browser.menu.item.WebExtensionBrowserMenuItem
......@@ -96,20 +95,10 @@ class WebExtensionBrowserMenuBuilder(
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) {
listOf(backPressMenuItem) + BrowserMenuDivider() +
filteredExtensionMenuItems +
BrowserMenuDivider() + addonsManagerMenuItem
filteredExtensionMenuItems
} else {
listOf(addonsManagerMenuItem) + BrowserMenuDivider() +
filteredExtensionMenuItems +
BrowserMenuDivider() + backPressMenuItem
}
......@@ -125,25 +114,21 @@ class WebExtensionBrowserMenuBuilder(
endOfMenuAlwaysVisible = endOfMenuAlwaysVisible
)
} else {
BrowserMenuImageText(
label = context.getString(R.string.mozac_browser_menu_addons),
imageResource = style.addonsManagerMenuItemDrawableRes,
iconTintColorResource = style.webExtIconTintColorResource
) {
onAddonsManagerTapped.invoke()
}
null
}
val mainMenuIndex = items.indexOfFirst { browserMenuItem ->
(browserMenuItem as? WebExtensionPlaceholderMenuItem)?.id ==
WebExtensionPlaceholderMenuItem.MAIN_EXTENSIONS_MENU_ID
}
return if (mainMenuIndex != -1) {
return if (mainMenuIndex != -1 && addonsMenuItem != null) {
items[mainMenuIndex] = addonsMenuItem
items
// if we do not have a placeholder we should add the extension submenu at top or bottom
} else {
if (appendExtensionSubMenuAtStart) {
if (addonsMenuItem == null) {
items
} else if (appendExtensionSubMenuAtStart) {
listOf(addonsMenuItem) + items
} else {
items + addonsMenuItem
......
......@@ -499,6 +499,7 @@ class DisplayToolbar internal constructor(
@ColorInt val color = when (siteSecurity) {
Toolbar.SiteSecurity.INSECURE -> colors.securityIconInsecure
Toolbar.SiteSecurity.SECURE -> colors.securityIconSecure
Toolbar.SiteSecurity.ONION -> colors.securityIconSecure
}
if (color == Color.TRANSPARENT) {
views.securityIndicator.clearColorFilter()
......
......@@ -43,6 +43,11 @@ internal class SiteSecurityIconView @JvmOverloads constructor(
View.mergeDrawableStates(drawableState, intArrayOf(R.attr.state_site_secure))
drawableState
}
SiteSecurity.ONION -> {
val drawableState = super.onCreateDrawableState(extraSpace + 1)
View.mergeDrawableStates(drawableState, intArrayOf(R.attr.state_site_onion))
drawableState
}
}
}
}
......@@ -3,6 +3,9 @@
- 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/. -->
<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
android:drawable="@drawable/mozac_ic_lock"
ac:state_site_secure="true" />
......
......@@ -27,6 +27,10 @@
<attr name="state_site_secure" format="boolean"/>
</declare-styleable>
<declare-styleable name="BrowserToolbarSiteOnionState">
<attr name="state_site_onion" format="boolean"/>
</declare-styleable>
<declare-styleable name="ActionContainer">
<attr name="actionContainerItemSize" format="dimension" />
</declare-styleable>
......
......@@ -9,6 +9,7 @@ import android.graphics.Bitmap
import androidx.annotation.CallSuper
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_ONLY_FIRST_PARTY
import mozilla.components.concept.engine.content.blocking.Tracker
import mozilla.components.concept.engine.history.HistoryItem
import mozilla.components.concept.engine.manifest.WebAppManifest
......@@ -384,7 +385,9 @@ abstract class EngineSession(
companion object {
fun none() = TrackingProtectionPolicy(
trackingCategories = arrayOf(TrackingCategory.NONE),
cookiePolicy = ACCEPT_ALL
useForPrivateSessions = false,
useForRegularSessions = false,
cookiePolicy = ACCEPT_ONLY_FIRST_PARTY
)
/**
......
......@@ -184,6 +184,13 @@ abstract class Settings {
* Setting to control whether enterprise root certs are enabled.
*/
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(
override var forceUserScalableContent: Boolean = false,
override var loginAutofillEnabled: Boolean = false,
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()
class UnsupportedSetting<T> {
......
......@@ -48,7 +48,8 @@ data class Request(
val redirect: Redirect = Redirect.FOLLOW,
val cookiePolicy: CookiePolicy = CookiePolicy.INCLUDE,
val useCaches: Boolean = true,
val private: Boolean = false
val private: Boolean = false,
val origin: String? = null
) {
/**
* A [Body] to be send with the [Request].
......
......@@ -414,6 +414,7 @@ interface Toolbar {
enum class SiteSecurity {
INSECURE,
SECURE,
ONION,
}
/**
......
......@@ -58,7 +58,7 @@ internal const val PAGE_SIZE = 50
* cache is being used by default
*/
@Suppress("LongParameterList")
class AddonCollectionProvider(
open class AddonCollectionProvider(
private val context: Context,
private val client: Client,
private val serverURL: String = DEFAULT_SERVER_URL,
......@@ -173,7 +173,7 @@ class AddonCollectionProvider(
* a connectivity problem or a timeout.
*/
@Throws(IOException::class)
suspend fun getAddonIconBitmap(addon: Addon): Bitmap? {
open suspend fun getAddonIconBitmap(addon: Addon): Bitmap? {
var bitmap: Bitmap? = null
if (addon.iconUrl != "") {
client.fetch(
......@@ -191,7 +191,7 @@ class AddonCollectionProvider(
}
@VisibleForTesting
internal fun writeToDiskCache(collectionResponse: String, language: String?) {
protected fun writeToDiskCache(collectionResponse: String, language: String?) {
synchronized(diskCacheLock) {
getCacheFile(context, language, useFallbackFile = false).writeString { collectionResponse }
}
......
......@@ -63,6 +63,7 @@
/>
<androidx.appcompat.widget.AppCompatCheckBox
android:visibility="gone"
android:id="@+id/allow_in_private_browsing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -42,6 +42,7 @@ dependencies {
implementation Dependencies.kotlin_stdlib
implementation Dependencies.kotlin_coroutines
implementation project(path: ':support-utils')
testImplementation project(':support-test')
testImplementation project(':support-test-libstate')
......
......@@ -100,7 +100,7 @@ class AppLinksFeature(
)
}
if (!tab.content.private || fragmentManager == null) {
if (true || !tab.content.private || fragmentManager == null) {
doOpenApp()
return
}
......
......@@ -21,6 +21,7 @@ import mozilla.components.support.ktx.android.net.isHttpOrHttps
import java.lang.Exception
import java.lang.NullPointerException
import java.net.URISyntaxException
import mozilla.components.support.utils.TorUtils
private const val EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url"
private const val MARKET_INTENT_URI_PACKAGE_PREFIX = "market://details?id="
......@@ -211,7 +212,7 @@ class AppLinksUseCases(
if (launchInNewTask) {
it.flags = it.flags or Intent.FLAG_ACTIVITY_NEW_TASK
}
context.startActivity(it)
TorUtils.startActivityPrompt(context, it)
} catch (e: Exception) {
when (e) {
is ActivityNotFoundException, is SecurityException, is NullPointerException -> {
......
......@@ -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.kotlin.stripMailToProtocol
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.
......@@ -358,7 +359,7 @@ data class ContextMenuCandidate(
context.getString(R.string.mozac_feature_contextmenu_share_link)
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(shareIntent)
TorUtils.startActivityPrompt(context, shareIntent)
}
)
......
......@@ -21,6 +21,8 @@ android {
arg("room.schemaLocation", "$projectDir/schemas".toString())
}
}
buildConfigField("boolean", "ANDROID_DOWNLOADS_INTEGRATION", "false")
}
buildTypes {
......