diff options
| author | Patrick Scott <phanna@android.com> | 2010-02-02 11:19:25 -0500 |
|---|---|---|
| committer | Patrick Scott <phanna@android.com> | 2010-02-02 11:20:54 -0500 |
| commit | 8af3cfc2a45334bfe936fcfc79c6e1cab06e104b (patch) | |
| tree | d05c7c05c72daa67811d482ef9169c2d32a551fa /core/java/android/webkit/FileLoader.java | |
| parent | 5e7bb0a9cafc5e90bf451faa5722bb80fb4294e9 (diff) | |
Check for null data after decoding a data: url.
Refactor StreamLoader and friends since they all use a Context. Change the
successful status to 200 instead of 0. Not sure why it was ever 0.
Bug: 2364322
Diffstat (limited to 'core/java/android/webkit/FileLoader.java')
| -rw-r--r-- | core/java/android/webkit/FileLoader.java | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/core/java/android/webkit/FileLoader.java b/core/java/android/webkit/FileLoader.java index 974ccbf4ac59..e856cdea372c 100644 --- a/core/java/android/webkit/FileLoader.java +++ b/core/java/android/webkit/FileLoader.java @@ -38,7 +38,6 @@ import java.lang.reflect.Field; class FileLoader extends StreamLoader { private String mPath; // Full path to the file to load - private Context mContext; // Application context, used for asset/res loads private int mType; // Indicates the type of the load private boolean mAllowFileAccess; // Allow/block file system access @@ -57,16 +56,14 @@ class FileLoader extends StreamLoader { * * @param url Full file url pointing to content to be loaded * @param loadListener LoadListener to pass the content to - * @param context Context to use to access the asset. * @param asset true if url points to an asset. * @param allowFileAccess true if this WebView is allowed to access files * on the file system. */ - FileLoader(String url, LoadListener loadListener, Context context, - int type, boolean allowFileAccess) { + FileLoader(String url, LoadListener loadListener, int type, + boolean allowFileAccess) { super(loadListener); mType = type; - mContext = context; mAllowFileAccess = allowFileAccess; // clean the Url @@ -174,7 +171,7 @@ class FileLoader extends StreamLoader { mDataStream = new FileInputStream(mPath); mContentLength = (new File(mPath)).length(); } - mHandler.status(1, 1, 0, "OK"); + mHandler.status(1, 1, 200, "OK"); } catch (java.io.FileNotFoundException ex) { mHandler.error(EventHandler.FILE_NOT_FOUND_ERROR, errString(ex)); @@ -198,14 +195,13 @@ class FileLoader extends StreamLoader { * * @param url Full file url pointing to content to be loaded * @param loadListener LoadListener to pass the content to - * @param context Context to use to access the asset. * @param asset true if url points to an asset. * @param allowFileAccess true if this FileLoader can load files from the * file system. */ public static void requestUrl(String url, LoadListener loadListener, - Context context, int type, boolean allowFileAccess) { - FileLoader loader = new FileLoader(url, loadListener, context, type, + int type, boolean allowFileAccess) { + FileLoader loader = new FileLoader(url, loadListener, type, allowFileAccess); loader.load(); } |
