Commit 662ebfc0 authored by Matthew Finkel's avatar Matthew Finkel Committed by Georg Koppen
Browse files

Bug 28125 - Prevent non-Necko network connections

parent 3b3dbd54
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -72,6 +72,11 @@ public class SuggestClient {
            return mPrevResults;

        ArrayList<String> suggestions = new ArrayList<String>();
        if (AppConstants.isTorBrowser()) {
            Log.i(LOGTAG, "This is Tor Browser. Skipping.");
            return suggestions;
        }

        if (TextUtils.isEmpty(mSuggestTemplate) || TextUtils.isEmpty(query)) {
            return suggestions;
        }
+5 −0
Original line number Diff line number Diff line
@@ -124,6 +124,11 @@ public class PocketStoriesLoader extends AsyncTaskLoader<List<TopStory>> {
    }

    protected String makeAPIRequestWithKey(final String apiKey) {
        if (AppConstants.isTorBrowser()) {
            Log.i(LOGTAG, "This is Tor Browser. Skipping.");
            return null;
        }

        HttpURLConnection connection = null;

        final Uri uri = Uri.parse(GLOBAL_ENDPOINT)
+5 −0
Original line number Diff line number Diff line
@@ -555,6 +555,11 @@ public class Distribution {
            return false;
        }

        if (AppConstants.isTorBrowser()) {
            Log.i(LOGTAG, "This is Tor Browser. Skipping.");
            return false;
        }

        URI uri = getReferredDistribution(referrer);
        if (uri == null) {
            return false;
+6 −0
Original line number Diff line number Diff line
@@ -151,6 +151,12 @@ public abstract class BaseAction {
    protected HttpURLConnection buildHttpURLConnection(String url)
            throws UnrecoverableDownloadContentException, IOException {
        try {
            if (AppConstants.isTorBrowser()) {
                String erdcl = "This is Tor Browser. Downloading is disabled for: " + url;
                Log.i(LOGTAG, "This is Tor Browser. Skipping.");
                throw new UnrecoverableDownloadContentException(erdcl);
            }

            System.setProperty("http.keepAlive", "true");

            HttpURLConnection connection = (HttpURLConnection) ProxySelector.openConnectionWithProxy(new URI(url));
+7 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import com.squareup.picasso.Picasso;
import com.squareup.picasso.Downloader.Response;
import com.squareup.picasso.UrlConnectionDownloader;

import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.util.ProxySelector;

import java.io.File;
@@ -91,6 +92,12 @@ public class ImageLoader {

        @Override
        protected HttpURLConnection openConnection(Uri path) throws IOException {
            if (AppConstants.isTorBrowser()) {
                String err = "This is Tor Browser. Downloading is disabled for: " + path.toString();
                Log.i(LOGTAG, "This is Tor Browser. Skipping.");
                throw new IOException(err);
            }

            try {
                // This is annoying, but |path| is an android.net.Uri and
                // openConnectionWithProxy() accepts a java.net.URI
Loading