summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-03-23 15:39:46 -0400
committerLeon Scroggins <scroggo@google.com>2010-03-24 10:25:40 -0400
commit1bb1a911c35c9df5fdbcaca13f97aa29dcec6cfb (patch)
treeac3635e9059cdf1f10e3dc2a2022aca8dec5fc63
parent7f49b9e47416808d7ef5de77b4094fd83f50134d (diff)
downloadframeworks_base-1bb1a911c35c9df5fdbcaca13f97aa29dcec6cfb.zip
frameworks_base-1bb1a911c35c9df5fdbcaca13f97aa29dcec6cfb.tar.gz
frameworks_base-1bb1a911c35c9df5fdbcaca13f97aa29dcec6cfb.tar.bz2
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
-rw-r--r--api/current.xml2
-rw-r--r--core/java/android/webkit/BrowserFrame.java16
-rw-r--r--core/java/android/webkit/WebView.java12
-rw-r--r--core/java/android/webkit/WebViewCore.java4
4 files changed, 15 insertions, 19 deletions
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 @@ class BrowserFrame extends Handler {
/**
* 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 @@ class BrowserFrame extends Handler {
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 @@ class BrowserFrame extends Handler {
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 @@ public class WebView extends AbsoluteLayout
/**
* 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 @@ public class WebView extends AbsoluteLayout
* @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 @@ public class WebView extends AbsoluteLayout
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 @@ final class WebViewCore {
String mData;
String mMimeType;
String mEncoding;
- String mFailUrl;
+ String mHistoryUrl;
}
static class CursorData {
@@ -981,7 +981,7 @@ final class WebViewCore {
loadParams.mData,
loadParams.mMimeType,
loadParams.mEncoding,
- loadParams.mFailUrl);
+ loadParams.mHistoryUrl);
break;
case STOP_LOADING: