If failUrl(now historyUrl) is null, use "about:blank" instead of "".

This prevents a crash that is caused by calling
WebView.loadDataWithBaseUrl with a null failUrl (which I have renamed
to historyUrl).  Also update the docs to be more accurate.

Fixes the general case of bug 2522457

Change-Id: I832351ce1e0016b00e924a2f9b0097ae15fba34a
diff --git a/api/current.xml b/api/current.xml
index 868f6fc..047c25c 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -195481,7 +195481,7 @@
 </parameter>
 <parameter name="encoding" type="java.lang.String">
 </parameter>
-<parameter name="failUrl" type="java.lang.String">
+<parameter name="historyUrl" type="java.lang.String">
 </parameter>
 </method>
 <method name="loadUrl"
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index 344b390..6983d9f 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -213,21 +213,19 @@
 
     /**
      * Load the content as if it was loaded by the provided base URL. The
-     * failUrl is used as the history entry for the load data. If null or
-     * an empty string is passed for the failUrl, then no history entry is
-     * created.
+     * historyUrl is used as the history entry for the load data.
      * 
      * @param baseUrl Base URL used to resolve relative paths in the content
      * @param data Content to render in the browser
      * @param mimeType Mimetype of the data being passed in
      * @param encoding Character set encoding of the provided data.
-     * @param failUrl URL to use if the content fails to load or null.
+     * @param historyUrl URL to use as the history entry.
      */
     public void loadData(String baseUrl, String data, String mimeType,
-            String encoding, String failUrl) {
+            String encoding, String historyUrl) {
         mLoadInitFromJava = true;
-        if (failUrl == null) {
-            failUrl = "";
+        if (historyUrl == null || historyUrl.length() == 0) {
+            historyUrl = "about:blank";
         }
         if (data == null) {
             data = "";
@@ -241,7 +239,7 @@
         if (mimeType == null || mimeType.length() == 0) {
             mimeType = "text/html";
         }
-        nativeLoadData(baseUrl, data, mimeType, encoding, failUrl);
+        nativeLoadData(baseUrl, data, mimeType, encoding, historyUrl);
         mLoadInitFromJava = false;
     }
 
@@ -916,7 +914,7 @@
     private native void nativePostUrl(String url, byte[] postData);
 
     private native void nativeLoadData(String baseUrl, String data,
-            String mimeType, String encoding, String failUrl);
+            String mimeType, String encoding, String historyUrl);
 
     /**
      * Stop loading the current page.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 714ae70..6722bc6 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1483,10 +1483,8 @@
     /**
      * Load the given data into the WebView, use the provided URL as the base
      * URL for the content. The base URL is the URL that represents the page
-     * that is loaded through this interface. As such, it is used for the
-     * history entry and to resolve any relative URLs. The failUrl is used if
-     * browser fails to load the data provided. If it is empty or null, and the
-     * load fails, then no history entry is created.
+     * that is loaded through this interface. As such, it is used to resolve any
+     * relative URLs. The historyUrl is used for the history entry.
      * <p>
      * Note for post 1.0. Due to the change in the WebKit, the access to asset
      * files through "file:///android_asset/" for the sub resources is more
@@ -1501,10 +1499,10 @@
      * @param mimeType The MIMEType of the data. i.e. text/html. If null,
      *            defaults to "text/html"
      * @param encoding The encoding of the data. i.e. utf-8, us-ascii
-     * @param failUrl URL to use if the content fails to load or null.
+     * @param historyUrl URL to use as the history entry.  Can be null.
      */
     public void loadDataWithBaseURL(String baseUrl, String data,
-            String mimeType, String encoding, String failUrl) {
+            String mimeType, String encoding, String historyUrl) {
 
         if (baseUrl != null && baseUrl.toLowerCase().startsWith("data:")) {
             loadData(data, mimeType, encoding);
@@ -1516,7 +1514,7 @@
         arg.mData = data;
         arg.mMimeType = mimeType;
         arg.mEncoding = encoding;
-        arg.mFailUrl = failUrl;
+        arg.mHistoryUrl = historyUrl;
         mWebViewCore.sendMessage(EventHub.LOAD_DATA, arg);
         clearTextEntry(false);
     }
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 4e949dc..410227b 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -627,7 +627,7 @@
         String mData;
         String mMimeType;
         String mEncoding;
-        String mFailUrl;
+        String mHistoryUrl;
     }
 
     static class CursorData {
@@ -981,7 +981,7 @@
                                     loadParams.mData,
                                     loadParams.mMimeType,
                                     loadParams.mEncoding,
-                                    loadParams.mFailUrl);
+                                    loadParams.mHistoryUrl);
                             break;
 
                         case STOP_LOADING: