Backout c1161ca4bf13 for test failures
authorBenoit Girard <b56girard@gmail.com>
Tue, 21 Feb 2012 11:34:00 -0500
changeset 92513 6cf00c870da2a0915b8831558949d039f5a9c105
parent 92512 ad16a4fbcdc5980a2b3d357cff8f2e15df52fcc3
child 92514 374117be5b0d9e00c77be596674c143db5f54609
push idunknown
push userunknown
push dateunknown
milestone13.0a1
backs outc1161ca4bf13708a59c54cea9dda532dc50b1610
Backout c1161ca4bf13 for test failures
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoEvent.java
widget/android/AndroidJavaWrappers.cpp
widget/android/AndroidJavaWrappers.h
widget/android/nsAppShell.cpp
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1297,26 +1297,16 @@ abstract public class GeckoApp
                 onTabsChanged(tab);
             }
         });
 
         if (Tabs.getInstance().isSelectedTab(tab)) {
             Runnable r = new SessionSnapshotRunnable(tab);
             GeckoAppShell.getHandler().postDelayed(r, 500);
         }
-
-        GeckoAppShell.sendEventToGecko(
-            GeckoEvent.createMetaViewportQueryEvent(tab.getId(),
-                new GeckoEvent.Callback() {
-                    public void callback(GeckoEvent ev, String data) {
-                        Log.i(LOGTAG, "Meta Viewport Data:" + data);
-                        // To do: do something with this data
-                    } 
-                })
-            );
     }
 
     void handleShowToast(final String message, final String duration) {
         mMainHandler.post(new Runnable() {
             public void run() {
                 Toast toast;
                 if (duration.equals("long"))
                     toast = Toast.makeText(mAppContext, message, Toast.LENGTH_LONG);
--- a/mobile/android/base/GeckoEvent.java
+++ b/mobile/android/base/GeckoEvent.java
@@ -57,20 +57,16 @@ import java.lang.System;
 import android.util.Log;
 
 /* We're not allowed to hold on to most events given to us
  * so we save the parts of the events we want to use in GeckoEvent.
  * Fields have different meanings depending on the event type.
  */
 
 public class GeckoEvent {
-    public interface Callback {
-        public void callback(GeckoEvent event, String jsonData);
-    }
-
     private static final String LOGTAG = "GeckoEvent";
 
     private static final int INVALID = -1;
     private static final int NATIVE_POKE = 0;
     private static final int KEY_EVENT = 1;
     private static final int MOTION_EVENT = 2;
     private static final int ORIENTATION_EVENT = 3;
     private static final int ACCELERATION_EVENT = 4;
@@ -88,17 +84,16 @@ public class GeckoEvent {
     private static final int ACTIVITY_START = 17;
     private static final int BROADCAST = 19;
     private static final int VIEWPORT = 20;
     private static final int VISITED = 21;
     private static final int NETWORK_CHANGED = 22;
     private static final int PROXIMITY_EVENT = 23;
     private static final int ACTIVITY_RESUMING = 24;
     private static final int SCREENSHOT = 25;
-    private static final int META_VIEWPORT_QUERY = 26;
 
     public static final int IME_COMPOSITION_END = 0;
     public static final int IME_COMPOSITION_BEGIN = 1;
     public static final int IME_SET_TEXT = 2;
     public static final int IME_GET_TEXT = 3;
     public static final int IME_DELETE_TEXT = 4;
     public static final int IME_SET_SELECTION = 5;
     public static final int IME_GET_SELECTION = 6;
@@ -136,19 +131,16 @@ public class GeckoEvent {
     public int mRangeForeColor, mRangeBackColor;
     public Location mLocation;
     public Address  mAddress;
 
     public double mBandwidth;
     public boolean mCanBeMetered;
 
     public int mNativeWindow;
-    public int mTabId;
-
-    Callback mCallback;
 
     private GeckoEvent(int evType) {
         mType = evType;
     }
 
     public static GeckoEvent createPauseEvent(int activityDepth) {
         GeckoEvent event = new GeckoEvent(ACTIVITY_PAUSING);
         event.mFlags = activityDepth > 0 ? 1 : 0;
@@ -385,24 +377,16 @@ public class GeckoEvent {
 
     public static GeckoEvent createViewportEvent(ViewportMetrics viewport) {
         GeckoEvent event = new GeckoEvent(VIEWPORT);
         event.mCharacters = "Viewport:Change";
         event.mCharactersExtra = viewport.toJSON();
         return event;
     }
 
-    public static GeckoEvent createMetaViewportQueryEvent(int tabId, Callback callback) {
-        Log.i("GeckoEvent", "createMetaViewportQueryEvent");
-        GeckoEvent event = new GeckoEvent(META_VIEWPORT_QUERY);
-        event.mCallback = callback;
-        event.mTabId = tabId;
-        return event;
-    }
-
     public static GeckoEvent createLoadEvent(String uri) {
         GeckoEvent event = new GeckoEvent(LOAD_URI);
         event.mCharacters = uri;
         return event;
     }
 
     public static GeckoEvent createVisitedEvent(String data) {
         GeckoEvent event = new GeckoEvent(VISITED);
@@ -420,15 +404,9 @@ public class GeckoEvent {
     public static GeckoEvent createScreenshotEvent(int tabId, int sw, int sh, int dw, int dh) {
         GeckoEvent event = new GeckoEvent(SCREENSHOT);
         event.mPoints = new Point[2];
         event.mPoints[0] = new Point(sw, sh);
         event.mPoints[1] = new Point(dw, dh);
         event.mMetaState = tabId;
         return event;
     }
-
-    public void doCallback(String jsonData) {
-        if (mCallback != null) {
-            mCallback.callback(this, jsonData);
-        }
-    }
 }
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -71,18 +71,16 @@ jfieldID AndroidGeckoEvent::jPointerInde
 jfieldID AndroidGeckoEvent::jRangeTypeField = 0;
 jfieldID AndroidGeckoEvent::jRangeStylesField = 0;
 jfieldID AndroidGeckoEvent::jRangeForeColorField = 0;
 jfieldID AndroidGeckoEvent::jRangeBackColorField = 0;
 jfieldID AndroidGeckoEvent::jLocationField = 0;
 jfieldID AndroidGeckoEvent::jAddressField = 0;
 jfieldID AndroidGeckoEvent::jBandwidthField = 0;
 jfieldID AndroidGeckoEvent::jCanBeMeteredField = 0;
-jfieldID AndroidGeckoEvent::jTabIdField = 0;
-jmethodID AndroidGeckoEvent::jDoCallbackMethod = 0;
 
 jclass AndroidPoint::jPointClass = 0;
 jfieldID AndroidPoint::jXField = 0;
 jfieldID AndroidPoint::jYField = 0;
 
 jclass AndroidRect::jRectClass = 0;
 jfieldID AndroidRect::jBottomField = 0;
 jfieldID AndroidRect::jLeftField = 0;
@@ -205,19 +203,16 @@ AndroidGeckoEvent::InitGeckoEventClass(J
     jRangeTypeField = getField("mRangeType", "I");
     jRangeStylesField = getField("mRangeStyles", "I");
     jRangeForeColorField = getField("mRangeForeColor", "I");
     jRangeBackColorField = getField("mRangeBackColor", "I");
     jLocationField = getField("mLocation", "Landroid/location/Location;");
     jAddressField = getField("mAddress", "Landroid/location/Address;");
     jBandwidthField = getField("mBandwidth", "D");
     jCanBeMeteredField = getField("mCanBeMetered", "Z");
-
-    jTabIdField = getField("mTabId", "I");
-    jDoCallbackMethod = getMethod("doCallback", "(Ljava/lang/String;)V");
 }
 
 void
 AndroidGeckoSurfaceView::InitGeckoSurfaceViewClass(JNIEnv *jEnv)
 {
 #ifndef MOZ_JAVA_COMPOSITOR
     initInit();
 
@@ -585,20 +580,16 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jo
             break;
         }
 
         case LOAD_URI: {
             ReadCharactersField(jenv);
             break;
         }
 
-        case META_VIEWPORT_QUERY:
-            mTabId = jenv->GetIntField(jobj, jTabIdField);
-            break;
-
         case VIEWPORT:
         case BROADCAST: {
             ReadCharactersField(jenv);
             ReadCharactersExtraField(jenv);
             break;
         }
 
         case NETWORK_CHANGED: {
@@ -670,26 +661,16 @@ AndroidPoint::Init(JNIEnv *jenv, jobject
         mY = jenv->GetIntField(jobj, jYField);
     } else {
         mX = 0;
         mY = 0;
     }
 }
 
 void
-AndroidGeckoEvent::DoCallback(const nsAString& data) {
-    JNIEnv* env = AndroidBridge::GetJNIEnv();
-    if (!env)
-        return;
-    AndroidBridge::AutoLocalJNIFrame(env, 1);
-    jstring jData = env->NewString(nsPromiseFlatString(data).get(), data.Length());
-    env->CallVoidMethod(wrapped_obj, jDoCallbackMethod, jData);
-}
-
-void
 AndroidGeckoGLLayerClient::Init(jobject jobj)
 {
     NS_ASSERTION(wrapped_obj == nsnull, "Init called on non-null wrapped_obj!");
     wrapped_obj = jobj;
 
     // Register the view transform getter.
     AndroidBridge::Bridge()->SetViewTransformGetter(mViewTransformGetter);
 }
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -541,18 +541,16 @@ public:
     int RangeType() { return mRangeType; }
     int RangeStyles() { return mRangeStyles; }
     int RangeForeColor() { return mRangeForeColor; }
     int RangeBackColor() { return mRangeBackColor; }
     nsGeoPosition* GeoPosition() { return mGeoPosition; }
     nsGeoPositionAddress* GeoAddress() { return mGeoAddress; }
     double Bandwidth() { return mBandwidth; }
     bool CanBeMetered() { return mCanBeMetered; }
-    int TabId() { return mTabId; }
-    void DoCallback(const nsAString& data);
 
 protected:
     int mAction;
     int mType;
     int64_t mTime;
     nsTArray<nsIntPoint> mPoints;
     nsTArray<nsIntPoint> mPointRadii;
     nsTArray<int> mPointIndicies;
@@ -568,17 +566,16 @@ protected:
     double mX, mY, mZ;
     double mDistance;
     int mPointerIndex;
     nsString mCharacters, mCharactersExtra;
     nsRefPtr<nsGeoPosition> mGeoPosition;
     nsRefPtr<nsGeoPositionAddress> mGeoAddress;
     double mBandwidth;
     bool mCanBeMetered;
-    int mTabId;
 
     void ReadIntArray(nsTArray<int> &aVals,
                       JNIEnv *jenv,
                       jfieldID field,
                       PRUint32 count);
     void ReadFloatArray(nsTArray<float> &aVals,
                         JNIEnv *jenv,
                         jfieldID field,
@@ -623,19 +620,16 @@ protected:
     static jfieldID jRangeStylesField;
     static jfieldID jRangeForeColorField;
     static jfieldID jRangeBackColorField;
     static jfieldID jLocationField;
     static jfieldID jAddressField;
 
     static jfieldID jBandwidthField;
     static jfieldID jCanBeMeteredField;
-    static jfieldID jTabIdField;
-    
-    static jmethodID jDoCallbackMethod;
 
 public:
     enum {
         NATIVE_POKE = 0,
         KEY_EVENT = 1,
         MOTION_EVENT = 2,
         ORIENTATION_EVENT = 3,
         ACCELERATION_EVENT = 4,
@@ -654,17 +648,16 @@ public:
         ACTIVITY_START = 17,
         BROADCAST = 19,
         VIEWPORT = 20,
         VISITED = 21,
         NETWORK_CHANGED = 22,
         PROXIMITY_EVENT = 23,
         ACTIVITY_RESUMING = 24,
         SCREENSHOT = 25,
-        META_VIEWPORT_QUERY = 26,
         dummy_java_enum_list_end
     };
 
     enum {
         IME_COMPOSITION_END = 0,
         IME_COMPOSITION_BEGIN = 1,
         IME_SET_TEXT = 2,
         IME_GET_TEXT = 3,
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -55,17 +55,17 @@
 #include "mozilla/Hal.h"
 #include "prenv.h"
 
 #include "AndroidBridge.h"
 #include "nsDeviceMotionSystem.h"
 #include <android/log.h>
 #include <pthread.h>
 #include <wchar.h>
-#include "nsContentUtils.h"
+
 #ifdef MOZ_ANDROID_HISTORY
 #include "nsAndroidHistory.h"
 #endif
 
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG
 #include "prlog.h"
 #endif
@@ -449,43 +449,16 @@ nsAppShell::ProcessNextNativeEvent(bool 
         nsTArray<nsIntPoint> points = curEvent->Points();
         NS_ASSERTION(points.Length() != 2, "Screenshot event does not have enough coordinates");
         if (domWindow)
             bridge->TakeScreenshot(domWindow, 0, 0, points[0].x, points[0].y, points[1].x, points[1].y, curEvent->MetaState());
         break;
     }
 
 
-    case AndroidGeckoEvent::META_VIEWPORT_QUERY:
-    {
-        nsCOMPtr<nsIDOMWindow> domWindow;
-        mBrowserApp->GetWindowForTab(curEvent->TabId(), getter_AddRefs(domWindow));
-        if (!domWindow)
-            break;
-        nsCOMPtr<nsIDOMDocument> domDocument;
-        domWindow->GetDocument(getter_AddRefs(domDocument));
-        nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDocument);
-        if (!doc)
-            break;
-        ViewportInfo vi = nsContentUtils::GetViewportInfo(doc);
-        nsAutoString data;
-        data.AppendLiteral("{");
-        data.AppendPrintf("\"defaultZoom\": %f,", vi.defaultZoom);
-        data.AppendPrintf("\"minZoom\": %f,", vi.minZoom);
-        data.AppendPrintf("\"maxZoom\": %f,", vi.maxZoom);
-        data.AppendPrintf("\"width\": %d,", vi.width);
-        data.AppendPrintf("\"height\": %d,", vi.height);
-        data.AppendPrintf("\"autoSize\": %s,", vi.autoSize ? "true" : "false");
-        data.AppendPrintf("\"allowZoom\": %s,", vi.allowZoom ? "true" : "false");
-        data.AppendPrintf("\"autoScale\": %s", vi.autoScale ? "true" : "false");
-        data.AppendLiteral("}");
-
-        curEvent->DoCallback(data);
-    }
-        break;
     case AndroidGeckoEvent::VIEWPORT:
     case AndroidGeckoEvent::BROADCAST: {
 
         if (curEvent->Characters().Length() == 0)
             break;
 
         nsCOMPtr<nsIObserverService> obsServ =
             mozilla::services::GetObserverService();