Cherry-pick: [Android WebView] Fix crash in M38 WebView.

When adding an account to an Android device we get a WebView crash
due to some removed null checks. This patch adds those check back.

BUG=415666

Change-Id: I21674b02310878959149e7015d665a5c5b848954
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 8488038..fa3f4e9 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -873,8 +873,7 @@
      * Stops loading the current web contents.
      */
     public void stopLoading() {
-        assert mWebContents != null;
-        mWebContents.stop();
+        if (mWebContents != null) mWebContents.stop();
     }
 
     /**
@@ -883,8 +882,7 @@
      * @return The URL of the current page.
      */
     public String getUrl() {
-        assert mWebContents != null;
-        return mWebContents.getUrl();
+        return (mWebContents != null) ? mWebContents.getUrl() : null;
     }
 
     /**
@@ -893,8 +891,7 @@
      * @return The title of the current page.
      */
     public String getTitle() {
-        assert mWebContents != null;
-        return mWebContents.getTitle();
+        return (mWebContents != null) ? mWebContents.getTitle() : null;
     }
 
     /**
@@ -1344,8 +1341,7 @@
      * Inserts the provided markup sandboxed into the frame.
      */
     public void setupTransitionView(String markup) {
-        assert mWebContents != null;
-        mWebContents.setupTransitionView(markup);
+        if (mWebContents != null) mWebContents.setupTransitionView(markup);
     }
 
     /**
@@ -1353,8 +1349,7 @@
      * exiting-transition stylesheets.
      */
     public void beginExitTransition(String cssSelector) {
-        assert mWebContents != null;
-        mWebContents.beginExitTransition(cssSelector);
+        if (mWebContents != null) mWebContents.beginExitTransition(cssSelector);
     }
 
     /**
@@ -1378,8 +1373,7 @@
      *                 If no result is required, pass null.
      */
     public void evaluateJavaScript(String script, JavaScriptCallback callback) {
-        assert mWebContents != null;
-        mWebContents.evaluateJavaScript(script, callback, false);
+        if (mWebContents != null) mWebContents.evaluateJavaScript(script, callback, false);
     }
 
     /**
@@ -1389,8 +1383,7 @@
      * @param script The Javascript to execute.
      */
     public void evaluateJavaScriptEvenIfNotYetNavigated(String script) {
-        assert mWebContents != null;
-        mWebContents.evaluateJavaScript(script, null, true);
+        if (mWebContents != null) mWebContents.evaluateJavaScript(script, null, true);
     }
 
     /**
@@ -1414,7 +1407,7 @@
      * To be called when the ContentView is shown.
      */
     public void onShow() {
-        assert mWebContents != null;
+        if (mWebContents == null) return;
         mWebContents.onShow();
         setAccessibilityState(mAccessibilityManager.isEnabled());
     }
@@ -3092,8 +3085,7 @@
     }
 
     public void resumeResponseDeferredAtStart() {
-        assert mWebContents != null;
-        mWebContents.resumeResponseDeferredAtStart();
+        if (mWebContents != null) mWebContents.resumeResponseDeferredAtStart();
     }
 
     /**