Bug 674646 - Do not kill child process when AndroidBridge is not available. r=blassey
authorAlex Pakhotin <alexp@mozilla.com>
Wed, 27 Jul 2011 17:34:47 -0700
changeset 73965 33b34c07f8fc033dc09e468230194b78bfa5c0ed
parent 73964 9754cac0194cdd25979acae750cd3ca9ed32f734
child 73966 f53ac674db57caddc3e2e5d146df3ae0290ec580
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersblassey
bugs674646
milestone8.0a1
Bug 674646 - Do not kill child process when AndroidBridge is not available. r=blassey
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -560,34 +560,40 @@ ContentParent::RecvClipboardHasText(PRBo
                                       nsIClipboard::kGlobalClipboard, hasText);
     return true;
 }
 
 bool
 ContentParent::RecvGetSystemColors(const PRUint32& colorsCount, InfallibleTArray<PRUint32>* colors)
 {
 #ifdef ANDROID
-    if (!AndroidBridge::Bridge())
-        return false;
+    NS_ASSERTION(AndroidBridge::Bridge() != nsnull, "AndroidBridge is not available");
+    if (AndroidBridge::Bridge() == nsnull) {
+        // Do not fail - the colors won't be right, but it's not critical
+        return true;
+    }
 
     colors->AppendElements(colorsCount);
 
     // The array elements correspond to the members of AndroidSystemColors structure,
     // so just pass the pointer to the elements buffer
     AndroidBridge::Bridge()->GetSystemColors((AndroidSystemColors*)colors->Elements());
 #endif
     return true;
 }
 
 bool
 ContentParent::RecvGetIconForExtension(const nsCString& aFileExt, const PRUint32& aIconSize, InfallibleTArray<PRUint8>* bits)
 {
 #ifdef ANDROID
-    if (!AndroidBridge::Bridge())
-        return false;
+    NS_ASSERTION(AndroidBridge::Bridge() != nsnull, "AndroidBridge is not available");
+    if (AndroidBridge::Bridge() == nsnull) {
+        // Do not fail - just no icon will be shown
+        return true;
+    }
 
     bits->AppendElements(aIconSize * aIconSize * 4);
 
     AndroidBridge::Bridge()->GetIconForExtension(aFileExt, aIconSize, bits->Elements());
 #endif
     return true;
 }