Merge "Fix some poorly worded API documentation for WebView.loadDataWithBaseURL()"

This commit is contained in:
Steve Block
2011-06-09 03:48:41 -07:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 17 deletions

View File

@@ -1990,13 +1990,9 @@ public class WebView extends AbsoluteLayout
* 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
* restricted. If you provide null or empty string as baseUrl, you won't be
* able to access asset files. If the baseUrl is anything other than
* http(s)/ftp(s)/about/javascript as scheme, you can access asset files for
* sub resources.
*
* Note that content specified in this way can access local device files
* (via 'file' scheme URLs) only if baseUrl specifies a scheme other than
* 'http', 'https', 'ftp', 'ftps', 'about' or 'javascript'.
* @param baseUrl Url to resolve relative paths with, if null defaults to
* "about:blank"
* @param data A String of data in the given encoding.

View File

@@ -1141,16 +1141,13 @@ public final class WebViewCore {
if (baseUrl != null) {
int i = baseUrl.indexOf(':');
if (i > 0) {
/*
* In 1.0, {@link
* WebView#loadDataWithBaseURL} can access
* local asset files as long as the data is
* valid. In the new WebKit, the restriction
* is tightened. To be compatible with 1.0,
* we automatically add the scheme of the
* baseUrl for local access as long as it is
* not http(s)/ftp(s)/about/javascript
*/
// In 1.0, WebView.loadDataWithBaseURL() could access local
// asset files using 'file' scheme URLs as long as the data is
// valid. Later versions of WebKit have tightened the
// restriction around when pages can access such local URLs.
// To maintain compatibility with 1.0, we register the scheme of
// the baseUrl to be considered local, as long as it is not
// http(s)/ftp(s)/about/javascript.
String scheme = baseUrl.substring(0, i);
if (!scheme.startsWith("http") &&
!scheme.startsWith("ftp") &&