Commit 7c244897 authored by Wes Johnston's avatar Wes Johnston
Browse files

backout a965cebe4462 32220d7085e0 3689bb4199d8 d0c82cb6eb28 b295c8825acd and 95ab5c738512

parent 7cc963cb
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -39,9 +39,6 @@

package @ANDROID_PACKAGE_NAME@;
import java.util.List;
import java.util.ArrayList;

import android.database.Cursor;

public interface Actions {

@@ -95,9 +92,4 @@ public interface Actions {
    void sendSpecialKey(SpecialKey key);

    void drag(int startingX, int endingX, int startingY, int endingY);

    /**
     * Run a sql query on the specified database
     */
    public Cursor querySql(String dbPath, String sql);
}
+23 −44
Original line number Diff line number Diff line
@@ -166,13 +166,21 @@ public class FennecMochitestAssert implements Assert {
    }

    public void is(Object a, Object b, String name) {
        boolean pass = checkObjectsEqual(a,b);
        ok(pass, name, getEqualString(a,b, pass));
        boolean pass = a.equals(b);
        String diag = "got " + a.toString() + ", expected " + b.toString();
        if (pass) {
            diag = a.toString() + " should equal " + b.toString();
        }
        ok(pass, name, diag);
    }
    
    public void isnot(Object a, Object b, String name) {
        boolean pass = checkObjectsNotEqual(a,b);
        ok(pass, name, getNotEqualString(a,b,pass));
        boolean pass = !a.equals(b);
        String diag = "didn't expect " + a.toString() + ", but got it";
        if (pass) {
            diag = a.toString() + " should not equal " + b.toString();
        }
        ok(pass, name, diag);
    }

    public void ispixel(int actual, int r, int g, int b, String name) {
@@ -199,50 +207,21 @@ public class FennecMochitestAssert implements Assert {
    }

    public void todo_is(Object a, Object b, String name) {
        boolean pass = checkObjectsEqual(a,b);
        todo(pass, name, getEqualString(a,b,pass));
    }

    public void todo_isnot(Object a, Object b, String name) {
        boolean pass = checkObjectsNotEqual(a,b);
        todo(pass, name, getNotEqualString(a,b,pass));
    }

    private boolean checkObjectsEqual(Object a, Object b) {
        if (a == null || b == null) {
            if (a == null && b == null) {
                return true;
            }
            return false;
        } else {
            return a.equals(b);
        }
    }

    private String getEqualString(Object a, Object b, boolean pass) {
        boolean pass = a.equals(b);
        String diag = "got " + a.toString() + ", expected " + b.toString();
        if (pass) {
            return a + " should equal " + b;
        }
        return "got " + a + ", expected " + b;
    }

    private boolean checkObjectsNotEqual(Object a, Object b) {
        if (a == null || b == null) {
            if ((a == null && b != null) || (a != null && b == null)) {
                return true;
            } else {
                return false;
            }
        } else {
            return !a.equals(b);
            diag = a.toString() + " should equal " + b.toString();
        }
        todo(pass, name, diag);
    }
    
    private String getNotEqualString(Object a, Object b, boolean pass) {
    public void todo_isnot(Object a, Object b, String name) {
        boolean pass = !a.equals(b);
        String diag = "didn't expect " + a.toString() + ", but got it";
        if (pass) {
            return a + " should not equal " + b;
            diag = a.toString() + " should not equal " + b.toString();
        }
        return "didn't expect " + a + ", but got it";
        todo(pass, name, diag);
    }

    public void info(String name, String message) {
+2 −40
Original line number Diff line number Diff line
@@ -40,24 +40,19 @@
package @ANDROID_PACKAGE_NAME@;

import java.lang.Class;
import java.lang.ClassLoader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.Long;
import java.util.concurrent.SynchronousQueue;
import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.app.Instrumentation;
import android.database.Cursor;
import android.os.SystemClock;
import android.view.View;
import android.view.KeyEvent;
import android.util.Log;

import java.util.concurrent.SynchronousQueue;

import org.json.*;

@@ -79,7 +74,6 @@ public class FennecNativeActions implements Actions {
    private Method mSendGE;
    private Method mGetLayerClient;
    private Method mSetDrawListener;
    private static final String LOGTAG = "FennecNativeActions";

    public FennecNativeActions(Activity activity, Solo robocop, Instrumentation instrumentation) {
        mSolo = robocop;
@@ -355,36 +349,4 @@ public class FennecNativeActions implements Actions {
    public void drag(int startingX, int endingX, int startingY, int endingY) {
        mSolo.drag(startingX, endingX, startingY, endingY, 10);
    }

    public Cursor querySql(String dbPath, String sql) {
        try {
            ClassLoader classLoader = mGeckoApp.getClassLoader();
            Class sqlClass = classLoader.loadClass("org.mozilla.gecko.sqlite.SQLiteBridge");
            Class stringClass = String.class;
            Class stringArrayClass = String[].class;
            Class appshell = classLoader.loadClass("org.mozilla.gecko.GeckoAppShell");
            Class contextClass = Context.class;
    
            Constructor bridgeConstructor = sqlClass.getConstructor(stringClass);
            Method query = sqlClass.getMethod("rawQuery", stringClass, stringArrayClass);
            Method loadSQLiteLibs = appshell.getMethod("loadSQLiteLibs", contextClass, stringClass);
    
            Object bridge = bridgeConstructor.newInstance(dbPath);
    
            String resourcePath = mGeckoApp.getApplication().getPackageResourcePath();
            loadSQLiteLibs.invoke(null, mGeckoApp, resourcePath);
            return (Cursor)query.invoke(bridge, sql, null);
        } catch(ClassNotFoundException ex) {
            Log.e(LOGTAG, "Error getting class", ex);
        } catch(NoSuchMethodException ex) {
            Log.e(LOGTAG, "Error getting method", ex);
        } catch(InvocationTargetException ex) {
            Log.e(LOGTAG, "Error invoking method", ex);
        } catch(InstantiationException ex) {
            Log.e(LOGTAG, "Error calling constructor", ex);
        } catch(IllegalAccessException ex) {
            Log.e(LOGTAG, "Error using field", ex);
        }
        return null;
    }
}
+2 −13
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@

    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="@ANDROID_PACKAGE_NAME@.permissions.PASSWORD_PROVIDER"/>

#ifdef MOZ_WEBSMS_BACKEND
    <!-- WebSMS -->
@@ -117,13 +116,6 @@
            </intent-filter>
        </receiver>

        <receiver android:name="org.mozilla.gecko.GeckoMessageReceiver"
                  android:permission="@ANDROID_PACKAGE_NAME@.permissions.PASSWORD_PROVIDER">
            <intent-filter>
                  <action android:name="org.mozilla.gecko.INIT_PW"></action>
            </intent-filter>
        </receiver>

        <activity android:name="Restarter"
                  android:process="@ANDROID_PACKAGE_NAME@Restarter"
                  android:theme="@style/Gecko"
@@ -179,8 +171,8 @@

        <provider android:name="@ANDROID_PACKAGE_NAME@.db.PasswordsProvider"
                  android:authorities="@ANDROID_PACKAGE_NAME@.db.passwords"
                  android:permission="@ANDROID_PACKAGE_NAME@.permissions.PASSWORD_PROVIDER"
                  android:process="org.mozilla.gecko.PasswordsProvider"/>
                  android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"
                  android:protectionLevel="signature"/>

        <provider android:name="@ANDROID_PACKAGE_NAME@.db.FormHistoryProvider"
                  android:authorities="@ANDROID_PACKAGE_NAME@.db.formhistory"
@@ -197,9 +189,6 @@
    <permission android:name="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"
                android:protectionLevel="signature"/>

    <permission android:name="@ANDROID_PACKAGE_NAME@.permissions.PASSWORD_PROVIDER"
                android:protectionLevel="signature"/>

    <permission android:name="@ANDROID_PACKAGE_NAME@.permissions.FORMHISTORY_PROVIDER"
                android:protectionLevel="signature"/>

+6 −3
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ abstract public class GeckoApp
    public static final String ACTION_BOOKMARK      = "org.mozilla.gecko.BOOKMARK";
    public static final String ACTION_LOAD          = "org.mozilla.gecko.LOAD";
    public static final String ACTION_UPDATE        = "org.mozilla.gecko.UPDATE";
    public static final String ACTION_INIT_PW       = "org.mozilla.gecko.INIT_PW";
    public static final String SAVED_STATE_URI      = "uri";
    public static final String SAVED_STATE_TITLE    = "title";
    public static final String SAVED_STATE_VIEWPORT = "viewport";
@@ -122,6 +121,7 @@ abstract public class GeckoApp
    public static SurfaceView cameraView;
    public static GeckoApp mAppContext;
    public static boolean mDOMFullScreen = false;
    public static File sGREDir = null;
    public static Menu sMenu;
    private static GeckoThread sGeckoThread = null;
    public GeckoAppHandler mMainHandler;
@@ -1616,7 +1616,7 @@ abstract public class GeckoApp
            enableStrictMode();
        }

        GeckoAppShell.loadMozGlue();
        System.loadLibrary("mozglue");
        mMainHandler = new GeckoAppHandler();
        Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - onCreate");
        if (savedInstanceState != null) {
@@ -1687,6 +1687,9 @@ abstract public class GeckoApp
            mBrowserToolbar.updateTabCount(1);
        }

        if (sGREDir == null)
            sGREDir = new File(this.getApplicationInfo().dataDir);

        Uri data = intent.getData();
        if (data != null && "http".equals(data.getScheme()) &&
            isHostOnPrefetchWhitelist(data.getHost())) {
@@ -2510,7 +2513,7 @@ abstract public class GeckoApp
                        fileExt = name.substring(period);
                        fileName = name.substring(0, period);
                    }
                    File file = File.createTempFile(fileName, fileExt, GeckoAppShell.getGREDir(GeckoApp.mAppContext));
                    File file = File.createTempFile(fileName, fileExt, sGREDir);

                    FileOutputStream fos = new FileOutputStream(file);
                    InputStream is = cr.openInputStream(uri);
Loading