lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

  • 1 participants
  • 18530 discussions
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: NetCipher enabled, checks if orbot is installed
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 67aca67cc7b0802f19024ad39f3d70733a47ce49 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Mon Jul 20 21:46:25 2015 -0400 Orfox: NetCipher enabled, checks if orbot is installed Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- .../base/java/org/mozilla/gecko/BrowserApp.java | 32 ++- mobile/android/base/moz.build | 6 + mobile/android/base/strings.xml.in | 5 + .../netcipher/proxy/OrbotHelper.java | 186 ++++++++++++++++ .../netcipher/proxy/TorServiceUtils.java | 233 +++++++++++++++++++++ mobile/android/orfox/strings.xml.in | 5 + 6 files changed, 462 insertions(+), 5 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 9023618669ef..a532b454a263 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -174,6 +174,8 @@ import android.animation.ObjectAnimator; import org.json.JSONException; import org.json.JSONObject; +import info.guardianproject.netcipher.proxy.OrbotHelper; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; @@ -1068,6 +1070,30 @@ public class BrowserApp extends GeckoApp } } + public void checkStartOrbot() { + if (!OrbotHelper.isOrbotInstalled(this)) { + final Intent intent = OrbotHelper.getOrbotInstallIntent(this); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(R.string.install_orbot); + builder.setMessage(R.string.you_must_have_orbot); + builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + startActivity(intent); + } + }); + builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + } + }); + builder.show(); + } else { + OrbotHelper.requestStartTor(this); + } + } + @Override public void onResume() { super.onResume(); @@ -1076,11 +1102,7 @@ public class BrowserApp extends GeckoApp return; } - if (!mHasResumed) { - EventDispatcher.getInstance().unregisterGeckoThreadListener((GeckoEventListener) this, - "Prompt:ShowTop"); - mHasResumed = true; - } + checkStartOrbot(); processTabQueue(); diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 6c88464ab521..4dbb1c25fdab 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -12,6 +12,7 @@ include('android-services.mozbuild') geckoview_source_dir = TOPSRCDIR + '/mobile/android/geckoview/src/main/' geckoview_thirdparty_source_dir = TOPSRCDIR + '/mobile/android/geckoview/src/thirdparty/' +geckoview_netcipher_source_dir = TOPSRCDIR + '/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/' thirdparty_source_dir = TOPSRCDIR + '/mobile/android/thirdparty/' constants_jar = add_java_jar('constants') @@ -289,6 +290,11 @@ gvjar.sources += [geckoview_thirdparty_source_dir + f for f in [ 'java/com/googlecode/eyesfree/braille/selfbraille/WriteData.java', ]] +gvjar.sources += [geckoview_netcipher_source_dir + f for f in [ + 'OrbotHelper.java', + 'TorServiceUtils.java', +]] + gvjar.extra_jars += [ CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'], CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'], diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index 3511a4eca644..ec39107f8f60 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -28,6 +28,11 @@ #include ../search/strings/search_strings.xml.in #include ../services/strings.xml.in +#include ../orfox/strings.xml.in + + <string name="no_space_to_start_error">&no_space_to_start_error;</string> + <string name="error_loading_file">&error_loading_file;</string> + <string name="firstrun_panel_title_welcome">&firstrun_panel_title_welcome;</string> diff --git a/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/OrbotHelper.java b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/OrbotHelper.java new file mode 100644 index 000000000000..d6a632fda37d --- /dev/null +++ b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/OrbotHelper.java @@ -0,0 +1,186 @@ + +package info.guardianproject.netcipher.proxy; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.net.Uri; +import android.text.TextUtils; +import android.util.Log; + + +import java.util.List; + +public class OrbotHelper { + + private final static int REQUEST_CODE_STATUS = 100; + + public final static String ORBOT_PACKAGE_NAME = "org.torproject.android"; + public final static String ORBOT_MARKET_URI = "market://details?id=" + ORBOT_PACKAGE_NAME; + public final static String ORBOT_FDROID_URI = "https://f-droid.org/repository/browse/?fdid=" + + ORBOT_PACKAGE_NAME; + public final static String ORBOT_PLAY_URI = "https://play.google.com/store/apps/details?id=" + + ORBOT_PACKAGE_NAME; + + /** + * A request to Orbot to transparently start Tor services + */ + public final static String ACTION_START = "org.torproject.android.intent.action.START"; + /** + * {@link Intent} send by Orbot with {@code ON/OFF/STARTING/STOPPING} status + */ + public final static String ACTION_STATUS = "org.torproject.android.intent.action.STATUS"; + /** + * {@code String} that contains a status constant: {@link #STATUS_ON}, + * {@link #STATUS_OFF}, {@link #STATUS_STARTING}, or + * {@link #STATUS_STOPPING} + */ + public final static String EXTRA_STATUS = "org.torproject.android.intent.extra.STATUS"; + /** + * A {@link String} {@code packageName} for Orbot to direct its status reply + * to, used in {@link #ACTION_START} {@link Intent}s sent to Orbot + */ + public final static String EXTRA_PACKAGE_NAME = "org.torproject.android.intent.extra.PACKAGE_NAME"; + + /** + * All tor-related services and daemons are stopped + */ + public final static String STATUS_OFF = "OFF"; + /** + * All tor-related services and daemons have completed starting + */ + public final static String STATUS_ON = "ON"; + public final static String STATUS_STARTING = "STARTING"; + public final static String STATUS_STOPPING = "STOPPING"; + /** + * The user has disabled the ability for background starts triggered by + * apps. Fallback to the old Intent that brings up Orbot. + */ + public final static String STATUS_STARTS_DISABLED = "STARTS_DISABLED"; + + public final static String ACTION_START_TOR = "org.torproject.android.START_TOR"; + public final static String ACTION_REQUEST_HS = "org.torproject.android.REQUEST_HS_PORT"; + public final static int START_TOR_RESULT = 0x048079234; + public final static int HS_REQUEST_CODE = 9999; + + private final static String FDROID_PACKAGE_NAME = "org.fdroid.fdroid"; + private final static String PLAY_PACKAGE_NAME = "com.android.vending"; + + private OrbotHelper() { + // only static utility methods, do not instantiate + } + + public static boolean isOrbotRunning(Context context) { + int procId = TorServiceUtils.findProcessId(context); + + return (procId != -1); + } + + public static boolean isOrbotInstalled(Context context) { + return isAppInstalled(context, ORBOT_PACKAGE_NAME); + } + + private static boolean isAppInstalled(Context context, String uri) { + try { + PackageManager pm = context.getPackageManager(); + pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); + return true; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + + public static void requestHiddenServiceOnPort(Activity activity, int port) { + Intent intent = new Intent(ACTION_REQUEST_HS); + intent.setPackage(ORBOT_PACKAGE_NAME); + intent.putExtra("hs_port", port); + + activity.startActivityForResult(intent, HS_REQUEST_CODE); + } + + /** + * First, checks whether Orbot is installed. If Orbot is installed, then a + * broadcast {@link Intent} is sent to request Orbot to start transparently + * in the background. When Orbot receives this {@code Intent}, it will + * immediately reply to this all with its status via an + * {@link #ACTION_STATUS} {@code Intent} that is broadcast to the + * {@code packageName} of the provided {@link Context} (i.e. + * {@link Context#getPackageName()}. + * + * @param context the app {@link Context} will receive the reply + * @return whether the start request was sent to Orbot + */ + public static boolean requestStartTor(Context context) { + if (OrbotHelper.isOrbotInstalled(context)) { + Log.i("OrbotHelper", "requestStartTor " + context.getPackageName()); + Intent intent = getOrbotStartIntent(); + intent.putExtra(EXTRA_PACKAGE_NAME, context.getPackageName()); + context.sendBroadcast(intent); + return true; + } + return false; + } + + public static Intent getOrbotStartIntent() { + Intent intent = new Intent(ACTION_START); + intent.setPackage(ORBOT_PACKAGE_NAME); + return intent; + } + + /** + * First, checks whether Orbot is installed, then checks whether Orbot is + * running. If Orbot is installed and not running, then an {@link Intent} is + * sent to request Orbot to start, which will show the main Orbot screen. + * The result will be returned in + * {@link Activity#onActivityResult(int requestCode, int resultCode, Intent data)} + * with a {@code requestCode} of {@link START_TOR_RESULT} + * + * @param activity the {@link Activity} that gets the + * {@code START_TOR_RESULT} result + * @return whether the start request was sent to Orbot + */ + public static boolean requestShowOrbotStart(Activity activity) { + if (OrbotHelper.isOrbotInstalled(activity)) { + if (!OrbotHelper.isOrbotRunning(activity)) { + Intent intent = getShowOrbotStartIntent(); + activity.startActivityForResult(intent, START_TOR_RESULT); + return true; + } + } + return false; + } + + public static Intent getShowOrbotStartIntent() { + Intent intent = new Intent(ACTION_START_TOR); + intent.setPackage(ORBOT_PACKAGE_NAME); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + return intent; + } + + public static Intent getOrbotInstallIntent(Context context) { + final Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(ORBOT_MARKET_URI)); + + PackageManager pm = context.getPackageManager(); + List<ResolveInfo> resInfos = pm.queryIntentActivities(intent, 0); + + String foundPackageName = null; + for (ResolveInfo r : resInfos) { + Log.i("OrbotHelper", "market: " + r.activityInfo.packageName); + if (TextUtils.equals(r.activityInfo.packageName, FDROID_PACKAGE_NAME) + || TextUtils.equals(r.activityInfo.packageName, PLAY_PACKAGE_NAME)) { + foundPackageName = r.activityInfo.packageName; + break; + } + } + + if (foundPackageName == null) { + intent.setData(Uri.parse(ORBOT_FDROID_URI)); + } else { + intent.setPackage(foundPackageName); + } + return intent; + } +} diff --git a/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/TorServiceUtils.java b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/TorServiceUtils.java new file mode 100644 index 000000000000..e553ecac3543 --- /dev/null +++ b/mobile/android/geckoview/src/thirdparty/java/info/guardianproject/netcipher/proxy/TorServiceUtils.java @@ -0,0 +1,233 @@ +/* Copyright (c) 2009, Nathan Freitas, Orbot / The Guardian Project - http://openideals.com/guardian */ +/* See LICENSE for licensing information */ + +package info.guardianproject.netcipher.proxy; + +import android.content.Context; +import android.util.Log; + + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.URLEncoder; +import java.util.StringTokenizer; + +public class TorServiceUtils { + + private final static String TAG = "TorUtils"; + // various console cmds + public final static String SHELL_CMD_CHMOD = "chmod"; + public final static String SHELL_CMD_KILL = "kill -9"; + public final static String SHELL_CMD_RM = "rm"; + public final static String SHELL_CMD_PS = "ps"; + public final static String SHELL_CMD_PIDOF = "pidof"; + + public final static String CHMOD_EXE_VALUE = "700"; + + public static boolean isRootPossible() + { + + StringBuilder log = new StringBuilder(); + + try { + + // Check if Superuser.apk exists + File fileSU = new File("/system/app/Superuser.apk"); + if (fileSU.exists()) + return true; + + fileSU = new File("/system/app/superuser.apk"); + if (fileSU.exists()) + return true; + + fileSU = new File("/system/bin/su"); + if (fileSU.exists()) + { + String[] cmd = { + "su" + }; + int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); + if (exitCode != 0) + return false; + else + return true; + } + + // Check for 'su' binary + String[] cmd = { + "which su" + }; + int exitCode = TorServiceUtils.doShellCommand(cmd, log, false, true); + + if (exitCode == 0) { + Log.d(TAG, "root exists, but not sure about permissions"); + return true; + + } + + } catch (IOException e) { + // this means that there is no root to be had (normally) so we won't + // log anything + Log.e(TAG, "Error checking for root access", e); + + } catch (Exception e) { + Log.e(TAG, "Error checking for root access", e); + // this means that there is no root to be had (normally) + } + + Log.e(TAG, "Could not acquire root permissions"); + + return false; + } + + public static int findProcessId(Context context) { + String dataPath = context.getFilesDir().getParentFile().getParentFile().getAbsolutePath(); + String command = dataPath + "/" + OrbotHelper.ORBOT_PACKAGE_NAME + "/app_bin/tor"; + int procId = -1; + + try { + procId = findProcessIdWithPidOf(command); + + if (procId == -1) + procId = findProcessIdWithPS(command); + } catch (Exception e) { + try { + procId = findProcessIdWithPS(command); + } catch (Exception e2) { + Log.e(TAG, "Unable to get proc id for command: " + URLEncoder.encode(command), e2); + } + } + + return procId; + } + + // use 'pidof' command + public static int findProcessIdWithPidOf(String command) throws Exception + { + + int procId = -1; + + Runtime r = Runtime.getRuntime(); + + Process procPs = null; + + String baseName = new File(command).getName(); + // fix contributed my mikos on 2010.12.10 + procPs = r.exec(new String[] { + SHELL_CMD_PIDOF, baseName + }); + // procPs = r.exec(SHELL_CMD_PIDOF); + + BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); + String line = null; + + while ((line = reader.readLine()) != null) + { + + try + { + // this line should just be the process id + procId = Integer.parseInt(line.trim()); + break; + } catch (NumberFormatException e) + { + Log.e("TorServiceUtils", "unable to parse process pid: " + line, e); + } + } + + return procId; + + } + + // use 'ps' command + public static int findProcessIdWithPS(String command) throws Exception + { + + int procId = -1; + + Runtime r = Runtime.getRuntime(); + + Process procPs = null; + + procPs = r.exec(SHELL_CMD_PS); + + BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); + String line = null; + + while ((line = reader.readLine()) != null) + { + if (line.indexOf(' ' + command) != -1) + { + + StringTokenizer st = new StringTokenizer(line, " "); + st.nextToken(); // proc owner + + procId = Integer.parseInt(st.nextToken().trim()); + + break; + } + } + + return procId; + + } + + public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAsRoot, + boolean waitFor) throws Exception + { + + Process proc = null; + int exitCode = -1; + + if (runAsRoot) + proc = Runtime.getRuntime().exec("su"); + else + proc = Runtime.getRuntime().exec("sh"); + + OutputStreamWriter out = new OutputStreamWriter(proc.getOutputStream()); + + for (int i = 0; i < cmds.length; i++) + { + // TorService.logMessage("executing shell cmd: " + cmds[i] + + // "; runAsRoot=" + runAsRoot + ";waitFor=" + waitFor); + + out.write(cmds[i]); + out.write("\n"); + } + + out.flush(); + out.write("exit\n"); + out.flush(); + + if (waitFor) + { + + final char buf[] = new char[10]; + + // Consume the "stdout" + InputStreamReader reader = new InputStreamReader(proc.getInputStream()); + int read = 0; + while ((read = reader.read(buf)) != -1) { + if (log != null) + log.append(buf, 0, read); + } + + // Consume the "stderr" + reader = new InputStreamReader(proc.getErrorStream()); + read = 0; + while ((read = reader.read(buf)) != -1) { + if (log != null) + log.append(buf, 0, read); + } + + exitCode = proc.waitFor(); + + } + + return exitCode; + + } +} diff --git a/mobile/android/orfox/strings.xml.in b/mobile/android/orfox/strings.xml.in new file mode 100644 index 000000000000..e3a22974ed78 --- /dev/null +++ b/mobile/android/orfox/strings.xml.in @@ -0,0 +1,5 @@ +<!-- NetCipher Integration Strings, used for dialog --> + <string name="install_orbot">Install Orbot?</string> + <string name="you_must_have_orbot">You must have Orbot installed and activated to proxy traffic through it. Would you like to download it?</string> + <string name="yes">Yes</string> + <string name="no">No</string>
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: quit button added, functionality changed to bring it up to date with current GeckoApp.java class, earlier version seemed to have problems with quitting
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 25f95adb4015299cee5c6c8a14c3f3c849e7ad22 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Fri Jul 17 17:01:09 2015 -0400 Orfox: quit button added, functionality changed to bring it up to date with current GeckoApp.java class, earlier version seemed to have problems with quitting Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- mobile/android/base/java/org/mozilla/gecko/BrowserApp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 5eddca3cf726..9023618669ef 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -3428,7 +3428,7 @@ public class BrowserApp extends GeckoApp !PrefUtils.getStringSet(GeckoSharedPrefs.forProfile(this), ClearOnShutdownPref.PREF, new HashSet<String>()).isEmpty(); - aMenu.findItem(R.id.quit).setVisible(visible); + aMenu.findItem(R.id.quit).setVisible(true); // If tab data is unavailable we disable most of the context menu and related items and // return early.
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: Removed sync option from preferences
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 8f90bf1ab835668f38679bcf5129db85bc304b7a Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Fri Jul 17 13:27:07 2015 -0400 Orfox: Removed sync option from preferences Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- mobile/android/base/resources/xml/preferences.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mobile/android/base/resources/xml/preferences.xml b/mobile/android/base/resources/xml/preferences.xml index 06716cd9af91..08ee14ea443a 100644 --- a/mobile/android/base/resources/xml/preferences.xml +++ b/mobile/android/base/resources/xml/preferences.xml @@ -9,12 +9,6 @@ xmlns:gecko="http://schemas.android.com/apk/res-auto" android:enabled="false"> - <org.mozilla.gecko.preferences.SyncPreference android:key="android.not_a_preference.sync" - android:title="@string/pref_sync" - android:icon="@drawable/sync_avatar_default" - android:summary="@string/pref_sync_summary" - android:persistent="false" /> - <PreferenceScreen android:title="@string/pref_category_general" android:summary="@string/pref_category_general_summary" android:key="android.not_a_preference.general_screen"
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: queue URL Intents and Tab:Load events when Orbot is not yet started
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 7b8e8ea0d5ead3c243bd8f73b07ed815eaa3369d Author: Hans-Christoph Steiner <hans(a)eds.org> Date: Wed Sep 2 16:43:33 2015 +0200 Orfox: queue URL Intents and Tab:Load events when Orbot is not yet started Instead of failing when opening a URL and Tor is not ready, queue those Intents, then send them once we get STATUS_ON from Orbot. Tab:Load events seem to be the main way that URLs are sent to the browser engine. Trying to migrate these changes to 45, this might end up breaking it, not sure. Squash with 64604feef6326ed44101bde31edb666ffbf21352 Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- .../base/java/org/mozilla/gecko/BrowserApp.java | 21 +++++---------- .../main/java/org/mozilla/gecko/GeckoAppShell.java | 31 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 984f04eaf52c..b57fe27705fb 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -1077,21 +1077,12 @@ public class BrowserApp extends GeckoApp @Override public void onReceive(Context context, Intent intent) { if (TextUtils.equals(intent.getAction(), OrbotHelper.ACTION_STATUS)) { - Log.i(LOGTAG, getPackageName() + " received intent : " + intent.getAction() + " " + intent.getPackage()); - String status = intent.getStringExtra(OrbotHelper.EXTRA_STATUS) + " (" + intent.getStringExtra(OrbotHelper.EXTRA_PACKAGE_NAME) + ")"; - Log.i(LOGTAG, status); - - boolean enabled = (intent.getStringExtra(OrbotHelper.EXTRA_STATUS).equals(OrbotHelper.STATUS_ON)); - // TODO - /* - if(enabled) { - if (intent.hasExtra(OrbotHelper.EXTRA_PROXY_PORT_HTTP)) - Log.i(LOGTAG, "HTTP PROXY: " + intent.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_HTTP, -1)); - - if (intent.hasExtra(OrbotHelper.EXTRA_PROXY_PORT_SOCKS)) - Log.i(LOGTAG, "SOCKS PROXY: " + intent.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_SOCKS, -1)); - } - */ + String status = intent.getStringExtra(OrbotHelper.EXTRA_STATUS); + Tabs.getInstance().setTorStatus(status); + + if (status.equals(OrbotHelper.STATUS_ON)) { + GeckoAppShell.sendPendingUrlIntents(BrowserApp.this); + } } } }; diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java index a802126395b4..9f28742c02d7 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java @@ -21,9 +21,12 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Queue; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import android.annotation.SuppressLint; import org.mozilla.gecko.annotation.JNITarget; @@ -44,6 +47,8 @@ import org.mozilla.gecko.util.NativeJSObject; import org.mozilla.gecko.util.ProxySelector; import org.mozilla.gecko.util.ThreadUtils; +import info.guardianproject.netcipher.proxy.OrbotHelper; + import android.Manifest; import android.app.Activity; import android.app.ActivityManager; @@ -110,6 +115,8 @@ public class GeckoAppShell // We have static members only. private GeckoAppShell() { } + private static String torStatus; + private static final CrashHandler CRASH_HANDLER = new CrashHandler() { @Override protected String getAppPackageName() { @@ -187,6 +194,8 @@ public class GeckoAppShell static private int sDensityDpi; static private int sScreenDepth; + static final Queue<Intent> PENDING_URL_INTENTS = new ConcurrentLinkedQueue<Intent>(); + /* Is the value in sVibrationEndTime valid? */ private static boolean sVibrationMaybePlaying; @@ -254,6 +263,17 @@ public class GeckoAppShell return sLayerView; } + static void sendPendingUrlIntents() { + try { + Context context = getContext(); + while (!PENDING_URL_INTENTS.isEmpty()) { + final Intent intent = PENDING_URL_INTENTS.poll(); + context.startActivity(intent); + } + } catch (NoSuchElementException e) {} + } + + /** * Sends an asynchronous request to Gecko. * @@ -2236,4 +2256,15 @@ public class GeckoAppShell } return sScreenSize; } + + public static void setTorStatus(Intent intent) { + torStatus = intent.getStringExtra(OrbotHelper.EXTRA_STATUS); + if (OrbotHelper.STATUS_ON.equals(torStatus)) { + sendPendingUrlIntents(); + } + } + + public static String getTorStatus() { + return torStatus; + } }
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: Centralized proxy applied to CrashReporter, SuggestClient, Distribution, AbstractCommunicator and BaseResources.
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 8236f9c6273a9ff4a094fbe9203a14f3a9e0dd75 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Fri Jun 12 02:07:45 2015 -0400 Orfox: Centralized proxy applied to CrashReporter, SuggestClient, Distribution, AbstractCommunicator and BaseResources. Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- .../base/java/org/mozilla/gecko/CrashReporter.java | 5 ++++- .../base/java/org/mozilla/gecko/SuggestClient.java | 5 ++++- .../mozilla/gecko/distribution/Distribution.java | 5 ++++- mobile/android/base/moz.build | 4 +++- .../java/org/mozilla/gecko/util/ProxySettings.java | 21 +++++++++++++++++++++ .../org/mozilla/gecko/sync/net/BaseResource.java | 4 ++++ .../service/utils/AbstractCommunicator.java | 5 ++++- 7 files changed, 44 insertions(+), 5 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java b/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java index ce2384a4d4d4..577079954fae 100644 --- a/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java +++ b/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java @@ -17,11 +17,14 @@ import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; +import java.net.Proxy; +import java.net.InetSocketAddress; import java.nio.channels.Channels; import java.nio.channels.FileChannel; import java.util.zip.GZIPOutputStream; import org.mozilla.gecko.AppConstants.Versions; +import org.mozilla.gecko.util.ProxySettings; import android.annotation.SuppressLint; import android.app.AlertDialog; @@ -366,7 +369,7 @@ public class CrashReporter extends AppCompatActivity Log.i(LOGTAG, "server url: " + spec); try { URL url = new URL(spec); - HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(ProxySettings.getProxy()); conn.setRequestMethod("POST"); String boundary = generateBoundary(); conn.setDoOutput(true); diff --git a/mobile/android/base/java/org/mozilla/gecko/SuggestClient.java b/mobile/android/base/java/org/mozilla/gecko/SuggestClient.java index e43bbef1f48c..673feb54abdc 100644 --- a/mobile/android/base/java/org/mozilla/gecko/SuggestClient.java +++ b/mobile/android/base/java/org/mozilla/gecko/SuggestClient.java @@ -7,6 +7,8 @@ package org.mozilla.gecko; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; +import java.net.Proxy; +import java.net.InetSocketAddress; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; @@ -15,6 +17,7 @@ import java.util.ArrayList; import org.json.JSONArray; import org.mozilla.gecko.annotation.RobocopTarget; import org.mozilla.gecko.util.HardwareUtils; +import org.mozilla.gecko.util.ProxySettings; import android.content.Context; import android.text.TextUtils; @@ -87,7 +90,7 @@ public class SuggestClient { HttpURLConnection urlConnection = null; InputStream in = null; try { - urlConnection = (HttpURLConnection) url.openConnection(); + urlConnection = (HttpURLConnection) url.openConnection(ProxySettings.getProxy()); urlConnection.setConnectTimeout(mTimeout); urlConnection.setRequestProperty("User-Agent", USER_AGENT); in = new BufferedInputStream(urlConnection.getInputStream()); diff --git a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java index a7b0fe32d360..4b272109a0fc 100644 --- a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java +++ b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java @@ -18,6 +18,8 @@ import java.net.SocketException; import java.net.URI; import java.net.URISyntaxException; import java.net.UnknownHostException; +import java.net.Proxy; +import java.net.InetSocketAddress; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; @@ -44,6 +46,7 @@ import org.mozilla.gecko.Telemetry; import org.mozilla.gecko.annotation.JNITarget; import org.mozilla.gecko.util.FileUtils; import org.mozilla.gecko.util.HardwareUtils; +import org.mozilla.gecko.util.ProxySettings; import org.mozilla.gecko.util.ThreadUtils; import android.app.Activity; @@ -522,7 +525,7 @@ public class Distribution { Log.v(LOGTAG, "Downloading referred distribution: " + uri); try { - final HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection(); + final HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection(ProxySettings.getProxy()); // If the Search Activity starts, and we handle the referrer intent, this'll return // null. Recover gracefully in this case. diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 4dbb1c25fdab..9d93e47b222d 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -149,8 +149,9 @@ gujar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in 'util/NonEvictingLruCache.java', 'util/PrefUtils.java', 'util/ProxySelector.java', + 'util/ProxySettings.java', 'util/publicsuffix/PublicSuffix.java', - 'util/publicsuffix/PublicSuffixPatterns.java', + 'util/publicsuffix/PublicSuffixPatterns.java', 'util/RawResource.java', 'util/StringUtils.java', 'util/ThreadUtils.java', @@ -165,6 +166,7 @@ gujar.extra_jars = [ CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'], 'constants.jar', 'gecko-mozglue.jar', + 'sync-thirdparty.jar', ] gujar.javac_flags += ['-Xlint:all,-deprecation'] diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySettings.java new file mode 100644 index 000000000000..0f5d363d543f --- /dev/null +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ProxySettings.java @@ -0,0 +1,21 @@ +package org.mozilla.gecko.util; + +import java.net.InetSocketAddress; +import java.net.Proxy; + +import ch.boye.httpclientandroidlib.HttpHost; + +public class ProxySettings { + private static final String TOR_PROXY_ADDRESS = "127.0.0.1"; + private static final int TOR_PROXY_PORT = 8118; + + public static Proxy getProxy() { + // TODO make configurable + return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(TOR_PROXY_ADDRESS, TOR_PROXY_PORT)); + } + + public static HttpHost getProxyHost() { + // TODO make configurable + return new HttpHost(TOR_PROXY_ADDRESS, TOR_PROXY_PORT); + } +} diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java index 60bbc86bbca7..b52c38d1ab07 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java @@ -54,6 +54,9 @@ import ch.boye.httpclientandroidlib.params.HttpProtocolParams; import ch.boye.httpclientandroidlib.protocol.BasicHttpContext; import ch.boye.httpclientandroidlib.protocol.HttpContext; import ch.boye.httpclientandroidlib.util.EntityUtils; +import ch.boye.httpclientandroidlib.HttpHost; +import ch.boye.httpclientandroidlib.conn.params.ConnRoutePNames; +import org.mozilla.gecko.util.ProxySettings; /** * Provide simple HTTP access to a Sync server or similar. @@ -215,6 +218,7 @@ public class BaseResource implements Resource { // We could reuse these client instances, except that we mess around // with their parameters… so we'd need a pool of some kind. client = new DefaultHttpClient(getConnectionManager()); + client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, ProxySettings.getProxyHost()); // TODO: Eventually we should use Apache HttpAsyncClient. It's not out of alpha yet. // Until then, we synchronously make the request, then invoke our delegate's callback. diff --git a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java index 70816371a39c..f67b8bd45711 100644 --- a/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java +++ b/mobile/android/stumbler/java/org/mozilla/mozstumbler/service/utils/AbstractCommunicator.java @@ -17,6 +17,8 @@ import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.net.Proxy; +import java.net.InetSocketAddress; public abstract class AbstractCommunicator { @@ -73,7 +75,8 @@ public abstract class AbstractCommunicator { sMozApiKey = prefs.getMozApiKey(); } URL url = new URL(getUrlString() + "?key=" + sMozApiKey); - mHttpURLConnection = (HttpURLConnection) url.openConnection(); + Proxy torProxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8118)); + mHttpURLConnection = (HttpURLConnection) url.openConnection(torProxy); mHttpURLConnection.setRequestMethod("POST"); } catch (MalformedURLException e) { throw new IllegalArgumentException(e);
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: add BroadcastReceiver to receive Tor status from Orbot
by gk@torproject.org 20 Mar '18

20 Mar '18
commit a9dbc810f24b511ca2eb079ba19830106658c9a9 Author: Hans-Christoph Steiner <hans(a)eds.org> Date: Tue Sep 1 20:49:27 2015 +0200 Orfox: add BroadcastReceiver to receive Tor status from Orbot Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- .../base/java/org/mozilla/gecko/BrowserApp.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index a532b454a263..984f04eaf52c 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -120,10 +120,12 @@ import android.app.AlertDialog; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; +import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; @@ -1070,6 +1072,30 @@ public class BrowserApp extends GeckoApp } } + private BroadcastReceiver torStatusReceiver = new BroadcastReceiver() { + + @Override + public void onReceive(Context context, Intent intent) { + if (TextUtils.equals(intent.getAction(), OrbotHelper.ACTION_STATUS)) { + Log.i(LOGTAG, getPackageName() + " received intent : " + intent.getAction() + " " + intent.getPackage()); + String status = intent.getStringExtra(OrbotHelper.EXTRA_STATUS) + " (" + intent.getStringExtra(OrbotHelper.EXTRA_PACKAGE_NAME) + ")"; + Log.i(LOGTAG, status); + + boolean enabled = (intent.getStringExtra(OrbotHelper.EXTRA_STATUS).equals(OrbotHelper.STATUS_ON)); + // TODO + /* + if(enabled) { + if (intent.hasExtra(OrbotHelper.EXTRA_PROXY_PORT_HTTP)) + Log.i(LOGTAG, "HTTP PROXY: " + intent.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_HTTP, -1)); + + if (intent.hasExtra(OrbotHelper.EXTRA_PROXY_PORT_SOCKS)) + Log.i(LOGTAG, "SOCKS PROXY: " + intent.getIntExtra(OrbotHelper.EXTRA_PROXY_PORT_SOCKS, -1)); + } + */ + } + } + }; + public void checkStartOrbot() { if (!OrbotHelper.isOrbotInstalled(this)) { final Intent intent = OrbotHelper.getOrbotInstallIntent(this); @@ -1090,6 +1116,7 @@ public class BrowserApp extends GeckoApp }); builder.show(); } else { + registerReceiver(torStatusReceiver, new IntentFilter(OrbotHelper.ACTION_STATUS)); OrbotHelper.requestStartTor(this); } } @@ -1136,6 +1163,10 @@ public class BrowserApp extends GeckoApp if (mIsAbortingAppLaunch) { return; } + // Register for Prompt:ShowTop so we can foreground this activity even if it's hidden. + EventDispatcher.getInstance().registerGeckoThreadListener((GeckoEventListener) this, + "Prompt:ShowTop"); + unregisterReceiver(torStatusReceiver); for (final BrowserAppDelegate delegate : delegates) { delegate.onRestart(this);
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: receive Tor status in thread so they arrive when event sync blocks
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 444e865687a56e630fc511173a67d7e06acf746c Author: Hans-Christoph Steiner <hans(a)eds.org> Date: Thu Sep 10 12:52:52 2015 +0200 Orfox: receive Tor status in thread so they arrive when event sync blocks Run in thread so Tor status updates will be received while the Gecko event sync is blocking the main thread. This might not be the best approach since it probably means that the main UI will be frozen waiting for Tor to reach ON status. Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- mobile/android/base/java/org/mozilla/gecko/BrowserApp.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index b57fe27705fb..34f93ee56cdb 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -139,6 +139,9 @@ import android.nfc.NfcAdapter; import android.nfc.NfcEvent; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Looper; import android.os.StrictMode; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; @@ -1119,6 +1122,14 @@ public class BrowserApp extends GeckoApp if (mIsAbortingAppLaunch) { return; } + /* run in thread so Tor status updates will be received while the + * Gecko event sync is blocking the main thread */ + HandlerThread handlerThread = new HandlerThread("torStatusReceiver"); + handlerThread.start(); + Looper looper = handlerThread.getLooper(); + Handler handler = new Handler(looper); + registerReceiver(torStatusReceiver, new IntentFilter(OrbotHelper.ACTION_STATUS), + null, handler); checkStartOrbot();
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: Fix #1 - Improve build instructions
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 03f65d64913229abf74b964da309535db3919679 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Tue Jul 14 00:52:24 2015 -0400 Orfox: Fix #1 - Improve build instructions Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- README.md | 20 ++++++++++++++++++++ README.txt | 27 --------------------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md new file mode 100644 index 000000000000..8cf5ca26625a --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +## ORFOX BUILD STEPS: + +1) Move .mozconfig-android to .mozconfig OR run: +``` +export MOZCONFIG="tor-browser/.mozconfig-android" +``` +2) Checks if the all requirements for the build are fine with: +``` +./mach configure +``` +3) Builds the repo with: +``` +./mach build +``` +4) Creates the apk in tor-browser/MOZ_OBJDIR/dist/fennec-38.0.en-US.android-arm.apk +``` +./mach package +``` +### Note: this does not ship the addons, that is managed in a different repo: https://github.com/amoghbl1/orfox-addons. +### Steps to include these addons can be figured out looking at the jenkins script at https://github.com/amoghbl1/Orfox/blob/master/jenkins-build diff --git a/README.txt b/README.txt deleted file mode 100644 index 658c0dce3174..000000000000 --- a/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -An explanation of the Mozilla Source Code Directory Structure and links to -project pages with documentation can be found at: - - https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure - -For information on how to build Mozilla from the source code, see: - - http://developer.mozilla.org/en/docs/Build_Documentation - -To have your bug fix / feature added to Mozilla, you should create a patch and -submit it to Bugzilla (https://bugzilla.mozilla.org) Instructions are at: - - http://developer.mozilla.org/en/docs/Creating_a_patch - http://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree - -If you have a question about developing Mozilla, and can't find the solution -on http://developer.mozilla.org, you can try asking your question in a -mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups -are accessible on Google Groups, or news.mozilla.org with a NNTP reader.] - -You can download nightly development builds from the Mozilla FTP server. -Keep in mind that nightly builds, which are used by Mozilla developers for -testing, may be buggy. Firefox nightlies, for example, can be found at: - - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/ - - or - - http://nightly.mozilla.org/
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: Added tbb prefs to mobile.js Bug #5404 - We need a mobile friendly user-agent. Moving back to the default user-agent used by the esr38 build
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 908389c3fdbcd76ec7e2f6f4b57741253e9757a6 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Thu Jun 11 09:43:09 2015 -0400 Orfox: Added tbb prefs to mobile.js Bug #5404 - We need a mobile friendly user-agent. Moving back to the default user-agent used by the esr38 build Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- mobile/android/app/mobile.js | 226 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 216 insertions(+), 10 deletions(-) diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 2a64297c4bbe..437177a67250 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -905,16 +905,222 @@ pref("identity.fxaccounts.remote.oauth.uri", "https://oauth.accounts.firefox.com // Token server used by Firefox Account-authenticated Sync. pref("identity.sync.tokenserver.uri", "https://token.services.mozilla.com/1.0/sync/1.5"); -// Enable Presentation API -pref("dom.presentation.enabled", false); -pref("dom.presentation.discovery.enabled", true); -pref("dom.presentation.discovery.legacy.enabled", true); // for TV 2.5 backward capability +# Default Preferences +# Tor Browser Bundle +# Do not edit this file. -pref("dom.audiochannel.audioCompeting", true); -pref("dom.audiochannel.mediaControl", true); +// Please maintain unit tests at ./tbb-tests/browser_tor_TB4.js -// Space separated list of URLS that are allowed to send objects (instead of -// only strings) through webchannels. This list is duplicated in browser/app/profile/firefox.js -pref("webchannel.allowObject.urlWhitelist", "https://accounts.firefox.com https://content.cdn.mozilla.net https://input.mozilla.org https://support.mozilla.org https://install.mozilla.org"); +// Disable browser auto updaters and associated homepage notifications +pref("app.update.auto", false); +pref("app.update.enabled", false); +pref("browser.search.update", false); +pref("browser.rights.3.shown", true); +pref("browser.startup.homepage_override.mstone", "ignore"); +pref("startup.homepage_welcome_url", ""); +pref("startup.homepage_override_url", ""); + +// Disable "Slow startup" warnings and associated disk history +// (bug #13346) +pref("browser.slowStartup.notificationDisabled", true); +pref("browser.slowStartup.maxSamples", 0); +pref("browser.slowStartup.samples", 0); + +// Disk activity: Disable Browsing History Storage +pref("browser.privatebrowsing.autostart", true); +pref("browser.cache.disk.enable", false); +pref("browser.cache.offline.enable", false); +pref("dom.indexedDB.enabled", false); +pref("permissions.memory_only", true); +pref("network.cookie.lifetimePolicy", 2); +pref("browser.download.manager.retention", 1); +pref("security.nocertdb", true); + +// Disk activity: TBB Directory Isolation +pref("browser.download.useDownloadDir", false); +pref("browser.shell.checkDefaultBrowser", false); +pref("browser.download.manager.addToRecentDocs", false); + +// Misc privacy: Disk +pref("signon.rememberSignons", false); +pref("browser.formfill.enable", false); +pref("signon.autofillForms", false); +pref("browser.sessionstore.privacy_level", 2); +pref("media.cache_size", 0); + +// Misc privacy: Remote +pref("browser.send_pings", false); +pref("geo.enabled", false); +pref("geo.wifi.uri", ""); +pref("browser.search.suggest.enabled", false); +pref("browser.safebrowsing.enabled", false); +pref("browser.safebrowsing.malware.enabled", false); +pref("browser.download.manager.scanWhenDone", false); // prevents AV remote reporting of downloads +pref("extensions.ui.lastCategory", "addons://list/extension"); +pref("datareporting.healthreport.service.enabled", false); // Yes, all three of these must be set +pref("datareporting.healthreport.uploadEnabled", false); +pref("datareporting.policy.dataSubmissionEnabled", false); +pref("security.mixed_content.block_active_content", false); // Disable until https://bugzilla.mozilla.org/show_bug.cgi?id=878890 is patched +pref("browser.syncPromoViewsLeftMap", "{\"addons\":0, \"passwords\":0, \"bookmarks\":0}"); // Don't promote sync +pref("services.sync.engine.prefs", false); // Never sync prefs, addons, or tabs with other browsers +pref("services.sync.engine.addons", false); +pref("services.sync.engine.tabs", false); +pref("extensions.getAddons.cache.enabled", false); // https://blog.mozilla.org/addons/how-to-opt-out-of-add-on-metadata-updates/ + +// Fingerprinting +pref("webgl.min_capability_mode", true); +pref("webgl.disable-extensions", true); +pref("dom.battery.enabled", false); // fingerprinting due to differing OS implementations +pref("dom.network.enabled",false); // fingerprinting due to differing OS implementations +pref("browser.display.max_font_attempts",10); +pref("browser.display.max_font_count",10); +pref("gfx.downloadable_fonts.fallback_delay", -1); +// pref("general.appname.override", "Netscape"); +// pref("general.appversion.override", "5.0 (Windows)"); +// pref("general.oscpu.override", "Windows NT 6.1"); +// pref("general.platform.override", "Win32"); +pref("general.useragent.override", "Mozilla/5.0 (Android; Mobile; rv:38.0) Gecko/38.0 Firefox/38.0"); +// pref("general.productSub.override", "20100101"); +// pref("general.buildID.override", "20100101"); +// pref("browser.startup.homepage_override.buildID", "20100101"); +pref("general.useragent.vendor", ""); +pref("general.useragent.vendorSub", ""); +pref("dom.enable_performance", false); +pref("plugin.expose_full_path", false); +pref("browser.zoom.siteSpecific", false); +pref("intl.charset.default", "windows-1252"); +pref("browser.link.open_newwindow.restriction", 0); // Bug 9881: Open popups in new tabs (to avoid fullscreen popups) +pref("dom.gamepad.enabled", false); // bugs.torproject.org/13023 +pref("javascript.use_us_english_locale", true); +// pref("intl.accept_languages", "en-us, en"); // Set by Torbutton +// pref("intl.accept_charsets", "iso-8859-1,*,utf-8"); // Set by Torbutton +// pref("intl.charsetmenu.browser.cache", "UTF-8"); // Set by Torbutton +// Disable video statistics fingerprinting vector (bug 15757) +pref("media.video_stats.enabled", false); +// Disable device sensors as possible fingerprinting vector (bug 15758) +pref("device.sensors.enabled", false); + +// Third party stuff +pref("network.cookie.cookieBehavior", 1); +pref("security.enable_tls_session_tickets", false); +pref("network.http.spdy.enabled", false); // Stores state and may have keepalive issues (both fixable) +pref("network.http.spdy.enabled.v2", false); // Seems redundant, but just in case +pref("network.http.spdy.enabled.v3", false); // Seems redundant, but just in case +pref("privacy.thirdparty.isolate", 2); // Always enforce third party isolation +pref("dom.workers.sharedWorkers.enabled", false); // See https://bugs.torproject.org/15562 + +// Proxy and proxy security +pref("network.proxy.socks", "127.0.0.1"); +pref("network.proxy.socks_port", 9050); +pref("network.proxy.socks_remote_dns", true); +pref("network.proxy.no_proxies_on", ""); // For fingerprinting and local service vulns (#10419) +pref("network.proxy.type", 1); +pref("network.security.ports.banned", "9050,9051,9150,9151"); +pref("network.dns.disablePrefetch", true); +pref("network.protocol-handler.external-default", false); +pref("network.protocol-handler.external.mailto", false); +pref("network.protocol-handler.external.news", false); +pref("network.protocol-handler.external.nntp", false); +pref("network.protocol-handler.external.snews", false); +pref("network.protocol-handler.warn-external.mailto", true); +pref("network.protocol-handler.warn-external.news", true); +pref("network.protocol-handler.warn-external.nntp", true); +pref("network.protocol-handler.warn-external.snews", true); +pref("plugin.disable", true); // Disable to search plugins on first start +pref("plugins.click_to_play", true); +pref("plugin.state.flash", 1); +pref("plugins.hide_infobar_for_missing_plugin", true); +pref("plugins.hideMissingPluginsNotification", true); +pref("media.peerconnection.enabled", false); // Disable WebRTC interfaces + +// Security slider +pref("svg.in-content.enabled", true); +pref("mathml.disabled", false); + +// Network and performance +pref("network.http.pipelining", true); +pref("network.http.pipelining.aggressive", true); +pref("network.http.pipelining.maxrequests", 12); +pref("network.http.pipelining.ssl", true); +pref("network.http.proxy.pipelining", true); +pref("security.ssl.enable_false_start", true); +pref("network.http.connection-retry-timeout", 0); +pref("network.http.max-persistent-connections-per-proxy", 256); +pref("network.http.pipelining.reschedule-timeout", 15000); +pref("network.http.pipelining.read-timeout", 60000); +// Hacked pref: Now means "Attempt to pipeline at least this many requests together" +pref("network.http.pipelining.max-optimistic-requests", 3); +pref("security.ssl.disable_session_identifiers", true); + +// Extension support +pref("extensions.autoDisableScopes", 0); +pref("extensions.bootstrappedAddons", "{}"); +pref("extensions.checkCompatibility.4.*", false); +pref("extensions.databaseSchema", 3); +pref("extensions.enabledAddons", "https-everywhere%40eff.org:3.1.4,%7B73a6fe31-595d-460b-a920-fcc0f8843232%7D:2.6.6.1,torbutton%40torproject.org:1.5.2,ubufox%40ubuntu.com:2.6,tor-launcher%40torproject.org:0.1.1pre-alpha,%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D:17.0.5"); +pref("extensions.enabledItems", "langpack-en-US@firefox.mozilla.org:,{73a6fe31-595d-460b-a920-fcc0f8843232}:1.9.9.57,{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}:1.2.4,{972ce4c6-7e08-4474-a285-3208198ce6fd}:3.5.8"); +pref("extensions.enabledScopes", 1); +pref("extensions.pendingOperations", false); +pref("xpinstall.whitelist.add", ""); +pref("xpinstall.whitelist.add.36", ""); + + +// Putting the search engine prefs into this file to fix #11236. +// Default search engine +pref("browser.search.defaultenginename", "Search"); + +// Search engine order (order displayed in the search bar dropdown) +// Somewhat surprisingly we get some random behavior if we specify more than +// two search engines as below. See +// https://bugzilla.mozilla.org/show_bug.cgi?id=1126722 for details. +pref("browser.search.order.extra.1", "Search"); +pref("browser.search.order.extra.2", "YouTube"); + +// Audio_data is deprecated in future releases, but still present +// in FF24. This is a dangerous combination (spotted by iSec) +pref("media.audio_data.enabled", false); + +// If true, remote JAR files will not be opened, regardless of content type +// Patch done by Jeff Gibat (iSEC). We bind it to the security slider but allow +// jar: in default mode. +pref("network.jar.block-remote-files", false); + +// Enable TLS 1.1 and 1.2: +// https://trac.torproject.org/projects/tor/ticket/11253 +pref("security.tls.version.max", 3); + +#ifdef TOR_BROWSER_VERSION +#expand pref("torbrowser.version", __TOR_BROWSER_VERSION__); +#endif -pref("media.openUnsupportedTypeWithExternalApp", true); +// More Orfox specific flags (some might be redundant) +pref("privacy.clearOnShutdown.cache", true); +pref("privacy.clearOnShutdown.cookies",true); +pref("privacy.clearOnShutdown.downloads",true); +pref("privacy.clearOnShutdown.formdata",true); +pref("privacy.clearOnShutdown.history",true); +pref("privacy.clearOnShutdown.offlineApps",true); +pref("privacy.clearOnShutdown.passwords",true); +pref("privacy.clearOnShutdown.sessions",true); +pref("privacy.clearOnShutdown.siteSettings",true); + +// Do Not Track! +pref("privacy.donottrackheader.enabled",false); +pref("privacy.donottrackheader.value",1); + +// Don't send a referrer: +pref("network.http.sendRefererHeader", 0); + +// Make sure certificates are up-to-date: +pref("security.OCSP.require", true); pref("security.checkloaduri",true); + +// Don't display mixed content (i.e. not secure content on a secure page) +pref("security.mixed_content.block_display_content", true); + +// Disable RTSP +pref("media.rtsp.enabled", false); +pref("media.rtsp.video.enabled", false); + +// Disable UDP Push service wakeup +pref("services.push.udp.wakeupEnabled", false); +pref("dom.push.udp.wakeupEnabled", false);
1 0
0 0
[tor-browser/tor-browser-52.7.2esr-8.0-1] Orfox: confvars changes to disable screen casting
by gk@torproject.org 20 Mar '18

20 Mar '18
commit 36df808f70e1108b926a1187a03387d4b4823878 Author: Amogh Pradeep <amoghbl1(a)gmail.com> Date: Wed Jun 10 17:12:02 2015 -0400 Orfox: confvars changes to disable screen casting Signed-off-by: Amogh Pradeep <amoghbl1(a)gmail.com> --- mobile/android/confvars.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mobile/android/confvars.sh b/mobile/android/confvars.sh index b4215ca89a0c..8af6925a6dc9 100644 --- a/mobile/android/confvars.sh +++ b/mobile/android/confvars.sh @@ -32,6 +32,11 @@ MOZ_RAW=1 MOZ_RUST_MP4PARSE=1 +MOZ_PLACES= +MOZ_SOCIAL= +MOZ_ANDROID_HISTORY=0 +MOZ_DISABLE_EXPORT_JS=1 + # use custom widget for html:select MOZ_USE_NATIVE_POPUP_WINDOWS=1 @@ -40,7 +45,7 @@ MOZ_APP_ID={aa3c5121-dab2-40e2-81ca-7ea25febc110} MOZ_APP_STATIC_INI=1 # Enable second screen using native Android libraries. -MOZ_NATIVE_DEVICES=1 +MOZ_NATIVE_DEVICES=0 # Enable install tracking SDK if we have Google Play support; MOZ_NATIVE_DEVICES # is a proxy flag for that support.
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 1498
  • 1499
  • 1500
  • 1501
  • 1502
  • 1503
  • 1504
  • ...
  • 1853
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.