New issue
Advanced search Search tips

Issue 669408 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Make DocumentLoader can take baseUrl to support loadDataWithbaseURL correctly

Project Member Reported by toyoshim@chromium.org, Nov 29 2016

Issue description

To implement WebView::loadDataWithBaseURL() correctly, documentLoader needs to take a baseUrl as a loading option.

See WebView::loadDataWithBaseURL() document.
https://developer.android.com/reference/android/webkit/WebView.html#loadDataWithBaseURL(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)

> void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl)
> Loads the given data into this WebView, using baseUrl as the base URL for the content. The base URL is used both to resolve relative URLs and when applying JavaScript's same origin policy.
> 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'.
> If the base URL uses the data scheme, this method is equivalent to calling loadData() and the historyUrl is ignored, and the data will be treated as part of a data: URL. If the base URL uses any other scheme, then the data will be loaded into the WebView as a plain string (i.e. not part of a data URL) and any URL-encoded entities in the string will not be decoded.
> Note that the baseUrl is sent in the 'Referer' HTTP header when requesting subresources (images, etc.) of the page loaded using this method.

The document does not explain what the page URL should be, but I assume it should be an encoded data in the data URL format.

But, the last note that the baseUrl is sent in the 'Referer' HTTP header seems to imply the baseUrl pretends the page URL.

Actually, current implementation sets the baseUrl to the page URL, and I guess the last note just says how this is implemented.

See also  crbug.com/662823  and crrev.com/2531013002.
 
Components: Mobile>WebView

Comment 2 by boliu@chromium.org, Dec 22 2016

Owner: toyoshim@chromium.org
Status: Assigned (was: Available)
> The document does not explain what the page URL should be, but I assume it should be an encoded data in the data URL format.

No. In the android docs, a few lines below where you pasted from:
"""
baseUrl	String: the URL to use as the page's base URL. If null defaults to 'about:blank'.
"""

So sounds like the current implementation is correct? What's the next step here? -> toyoshim
Cc: toyoshim@chromium.org
Owner: ----
Status: Available (was: Assigned)

Sign in to add a comment