Work around AwWebResourceResponse not supporting null headers.
This is a temporary workaround till we get the proper fix in upstream.
The AwWebResourceResponse constructor causes an NPE if a null headers
map is passed in.
BUG: 16332774
Change-Id: If8f9cf50385c459cfb5920785a3f44ef1aa97673
diff --git a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java
index 81ef3ca..a8af1dc 100644
--- a/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java
+++ b/chromium/java/com/android/webview/chromium/WebViewContentsClientAdapter.java
@@ -69,6 +69,7 @@
import java.security.Principal;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
+import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
@@ -312,13 +313,19 @@
new WebResourceRequestImpl(params));
TraceEvent.end();
if (response == null) return null;
+
+ // AwWebResourceResponse should support null headers. b/16332774.
+ Map<String, String> responseHeaders = response.getResponseHeaders();
+ if (responseHeaders == null)
+ responseHeaders = new HashMap<String, String>();
+
return new AwWebResourceResponse(
response.getMimeType(),
response.getEncoding(),
response.getData(),
response.getStatusCode(),
response.getReasonPhrase(),
- response.getResponseHeaders());
+ responseHeaders);
}
/**