Bug 1469683 - 2. Make child crashes throw special exception; r=esawin
authorJim Chen <nchen@mozilla.com>
Wed, 20 Jun 2018 16:46:21 -0400
changeset 423114 13ff68c7707d414ea98096933b322025a75ad871
parent 423113 2806729c61eaac199ad4670788c4008079a99f34
child 423115 c9487350a119359a14bce87083e34930ba6258df
push id34163
push usercsabou@mozilla.com
push dateThu, 21 Jun 2018 01:14:46 +0000
treeherdermozilla-central@e09fbaee1456 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1469683
milestone62.0a1
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 1469683 - 2. Make child crashes throw special exception; r=esawin Make child crashes throw ChildCrashException instead of the generic RuntimeException, which can mean a variety of errors such as timeout. MozReview-Commit-ID: H0E6gipkTxg
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt
@@ -2,16 +2,17 @@
  * Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 package org.mozilla.geckoview.test
 
 import org.mozilla.geckoview.GeckoSession
 import org.mozilla.geckoview.GeckoSessionSettings
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.AssertCalled
+import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.ChildCrashedException
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.ClosedSessionAtStart
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.IgnoreCrash
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.NullDelegate
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.RejectedPromiseException
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.ReuseSession
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.Setting
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.TimeoutException
 import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.TimeoutMillis
@@ -1659,17 +1660,17 @@ class GeckoSessionTestRuleTest : BaseSes
 
         mainSession.loadUri(CONTENT_CRASH_URL)
         mainSession.waitUntilCalled(object : Callbacks.ContentDelegate {
             @AssertCalled(count = 1)
             override fun onCrash(session: GeckoSession) = Unit
         })
     }
 
-    @Test(expected = RuntimeException::class)
+    @Test(expected = ChildCrashedException::class)
     @ReuseSession(false)
     fun contentCrashFails() {
         assumeThat(sessionRule.env.isMultiprocess, equalTo(true))
         assumeThat(sessionRule.env.shouldShutdownOnCrash(), equalTo(false))
         // Cannot test x86 debug builds due to Gecko's "ah_crap_handler"
         // that waits for debugger to attach during a SIGSEGV.
         assumeThat(sessionRule.env.isDebugBuild && sessionRule.env.cpuArch == "x86",
                    equalTo(false))
--- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java
+++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java
@@ -338,16 +338,22 @@ public class GeckoSessionTestRule extend
     }
 
     public static class TimeoutException extends RuntimeException {
         public TimeoutException(final String detailMessage) {
             super(detailMessage);
         }
     }
 
+    public static class ChildCrashedException extends RuntimeException {
+        public ChildCrashedException(final String detailMessage) {
+            super(detailMessage);
+        }
+    }
+
     public static class RejectedPromiseException extends RuntimeException {
         private final Object mReason;
 
         /* package */ RejectedPromiseException(final Object reason) {
             super(String.valueOf(reason));
             mReason = reason;
         }
 
@@ -1192,17 +1198,17 @@ public class GeckoSessionTestRule extend
                         session = (GeckoSession) args[0];
                     }
 
                     if (sOnCrash.equals(method) && !mIgnoreCrash && isUsingSession(session)) {
                         if (env.shouldShutdownOnCrash()) {
                             sRuntime.shutdown();
                         }
 
-                        throw new RuntimeException("Content process crashed");
+                        throw new ChildCrashedException("Child process crashed");
                     }
 
                     records.add(new CallRecord(session, method, args));
 
                     call = waitDelegates.prepareMethodCall(session, method);
                     if (call == null) {
                         call = testDelegates.prepareMethodCall(session, method);
                     }