New issue
Advanced search Search tips

Issue 854282 link

Starred by 2 users

Issue metadata

Status: Fixed
Closed: Jul 12
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Sign in to add a comment

WebView special protocol handlers can't load .svgz files

Project Member Reported by, Jun 19

Issue description

The implementation of AndroidProtocolHandler for the special file://android_asset/ and file://android_res/ URLs implements getMimeType just by passing the file extension to

This results in .svgz files not being supported. URLConnection is aware of this file extension and returns "image/svg+xml" as the MIME type, but nothing actually decodes the gzip encoding and the image fails to load. This works in regular file: URLs that aren't using WebView's special protocol handler because there is a special case for this specific extension that adds the gzip decoding filter:
WebView should probably do the same thing here and handle this extension as a special case.
See also issue 854283 for the more general issue of using a different MIME type map than Chromium in the first place.
Labels: -Pri-3 Pri-2
Status: Assigned (was: Available)
Paul, could you take a look?
This is awkward to support. Chrome uses GzipSourceStream, which uses SourceStream for both input and output. WebView uses InputStream and InputStreamReaderWrapper instead of SourceStream, and it's difficult to plumb between the two because the former support seeking while the latter doesn't.
Can't we just wrap the InputStream in an InflaterInputStream from the java stdlib to gunzip the data?
Oh neat, I didn't know about InflaterInputStream.
Project Member

Comment 7 by, Jul 12

The following revision refers to this bug:

commit 7a5feed58d4c2e2e8870d1dbd9e05e61039b9d27
Author: Paul Miller <>
Date: Thu Jul 12 18:04:43 2018

WebView: Support loading .svgz assets/resources

Loading .svgz files from the web works because of a special case in
URLRequestFileJob::SetUpSourceStream(). Add a special case in
AndroidProtocolHandler so that e.g.
WebView.loadUrl("file:///android_asset/foo.svgz") works as well.

BUG= 854282 

Change-Id: I995f8b602bd6e3b05818ede763f3774465850d82
Reviewed-by: Richard Coles <>
Commit-Queue: Paul Miller <>
Cr-Commit-Position: refs/heads/master@{#574634}

Status: Fixed (was: Assigned)

Sign in to add a comment