Bug 576381 - Avoid accessing AndroidBridge in child process, r=vlad
authorMichael Wu <mwu@mozilla.com>
Fri, 16 Jul 2010 11:24:42 -0700
changeset 47827 525cbac0423c60470e3bb8959f961a9680008258
parent 47826 0f1fddce41e12d15d5c08a47b5cabf23d3201e55
child 47828 57a696a3f5580e594e168ece70f7fa246dd99dd3
push id14432
push usermwu@mozilla.com
push dateFri, 16 Jul 2010 18:34:05 +0000
treeherderautoland@57a696a3f558 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad
bugs576381
milestone2.0b2pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 576381 - Avoid accessing AndroidBridge in child process, r=vlad
uriloader/exthandler/android/nsOSHelperAppService.cpp
widget/src/android/nsWindow.cpp
--- a/uriloader/exthandler/android/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/android/nsOSHelperAppService.cpp
@@ -32,30 +32,35 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsOSHelperAppService.h"
 #include "nsMIMEInfoAndroid.h"
+#include "AndroidBridge.h"
 
 nsOSHelperAppService::nsOSHelperAppService() : nsExternalHelperAppService()
 {
 }
 
 nsOSHelperAppService::~nsOSHelperAppService()
 {
 }
 
 already_AddRefed<nsIMIMEInfo>
 nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType,
                                         const nsACString& aFileExt,
                                         PRBool* aFound)
 {
+    // XXX Bug 579388 - need to remote this
+    if (!mozilla::AndroidBridge::Bridge())
+        return nsnull;
+
     *aFound = PR_FALSE;
     already_AddRefed<nsIMIMEInfo> mimeInfo = 
             nsMIMEInfoAndroid::GetMimeInfoForMimeType(aMIMEType);
     if (!mimeInfo.get())
             mimeInfo = nsMIMEInfoAndroid::GetMimeInfoForFileExt(aFileExt);
 
     *aFound = !!mimeInfo.get();
     
--- a/widget/src/android/nsWindow.cpp
+++ b/widget/src/android/nsWindow.cpp
@@ -473,16 +473,19 @@ nsWindow::FindTopLevel()
 
 NS_IMETHODIMP
 nsWindow::SetFocus(PRBool aRaise)
 {
     if (!aRaise)
         ALOG("nsWindow::SetFocus: can't set focus without raising, ignoring aRaise = false!");
 
     gFocusedWindow = this;
+    if (!AndroidBridge::Bridge())
+        return NS_OK;
+
     FindTopLevel()->BringToFront();
 
     return NS_OK;
 }
 
 void
 nsWindow::BringToFront()
 {
@@ -573,16 +576,19 @@ nsWindow::GetThebesSurface()
     // XXX this really wants to return already_AddRefed, but this only really gets used
     // on direct assignment to a gfxASurface
     return new gfxImageSurface(gfxIntSize(5,5), gfxImageSurface::ImageFormatRGB24);
 }
 
 void
 nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
 {
+    if (!AndroidBridge::Bridge())
+        return;
+
     switch (ae->Type()) {
         case AndroidGeckoEvent::SIZE_CHANGED: {
             int nw = ae->P0().x;
             int nh = ae->P0().y;
 
             if (nw == gAndroidBounds.width &&
                 nh == gAndroidBounds.height) {
                 return;
@@ -650,16 +656,19 @@ nsWindow::OnGlobalAndroidEvent(AndroidGe
         default:
             break;
     }
 }
 
 void
 nsWindow::OnAndroidEvent(AndroidGeckoEvent *ae)
 {
+    if (!AndroidBridge::Bridge())
+        return;
+
     switch (ae->Type()) {
         case AndroidGeckoEvent::DRAW:
             OnDraw(ae);
             break;
 
         default:
             ALOG("Window got targetted android event type %d, but didn't handle!", ae->Type());
             break;