OSDN Git Service

Fix postUrl to call loadUrl when url is not a network url.
authorHui Shu <hush@google.com>
Wed, 5 Feb 2014 17:30:36 +0000 (09:30 -0800)
committerHui Shu <hush@google.com>
Wed, 5 Feb 2014 21:32:37 +0000 (13:32 -0800)
Change-Id: I4be00611c220572b4e8ecea1a00409a6f5d2bb18

core/java/android/webkit/WebView.java

index 7ee33c1..826bcec 100644 (file)
@@ -845,8 +845,8 @@ public class WebView extends AbsoluteLayout
 
     /**
      * Loads the URL with postData using "POST" method into this WebView. If url
-     * is not a network URL, it will be loaded with {link
-     * {@link #loadUrl(String)} instead.
+     * is not a network URL, it will be loaded with {@link #loadUrl(String)}
+     * instead, ignoring the postData param.
      *
      * @param url the URL of the resource to load
      * @param postData the data will be passed to "POST" request, which must be
@@ -855,7 +855,11 @@ public class WebView extends AbsoluteLayout
     public void postUrl(String url, byte[] postData) {
         checkThread();
         if (DebugFlags.TRACE_API) Log.d(LOGTAG, "postUrl=" + url);
-        mProvider.postUrl(url, postData);
+        if (URLUtil.isNetworkUrl(url)) {
+            mProvider.postUrl(url, postData);
+        } else {
+            mProvider.loadUrl(url);
+        }
     }
 
     /**