Closed
Bug 948325
Opened 11 years ago
Closed 7 years ago
[GeckoView] Please add client-side proxy to load some static resources from asset.
Categories
(GeckoView :: General, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1322577
People
(Reporter: admin, Unassigned)
References
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36
Steps to reproduce:
Please add client proxy to load files from local.
Example:
Android WebView WebViewClient#shouldInterceptRequest()
Comment 1•11 years ago
|
||
Some notes:
1. We'll need a way to loadFromAssets
2. We'll need a way to implement shouldInterceptRequest
1. Intercept Gecko loads
2. Call into Java and call the ChromeDelegate (or ContentDelegate) callback
3. Pass the new URI back to Gecko
4. Get Gecko to replace the original URI with the new one
For #1, we should be able to create a JAR: URI that pulls from the APK "assets" folder
> URI apkURI = (new File(HTMLViewer.this.getPackageResourcePath())).toURI();
> String assetsURL = "jar:" + apkURI + "!/assets/";
> String myURL = assetsURL + "test.html";
(from BenB who got the idea from https://bug873569.bugzilla.mozilla.org/attachment.cgi?id=760740)
For #2:
shouldOverrideUrlLoading seems to let the app cancel the default load and do a different load. It only gets called when content starts the load, not when the WebView API is used. The load is done in Java via the WebView (GeckoView) loadXxx API. Gecko probably won't like that very much. We'll need to send the URL back to Gecko itself.
shouldInterceptRequest uses a WebResourceResponse object to return the new stream of data. This might not be the best approach given that we'd need to pass the data to Gecko.
I think we should create a way to replace the URL and pass the URL back to Gecko. The developer could pass an asset URL or a data: URL back to Gecko.
We should be able to use nsITraceableChannel to replace the loading URL.
Comment 2•11 years ago
|
||
This is a great idea. It would allow to e.g. download additional app resources to the SD card, then access them via normal URLs.
If the embedder just wants to ship some HTML+JS with the app and use that, bug 948465 file://android_asset/<foo> would be easier for the embedder. I think we need both facilities.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•7 years ago
|
||
Move some old bugs with `[geckoview]` in their summary to the GeckoView Bugzilla component.
Component: General → GeckoView
Updated•7 years ago
|
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Updated•6 years ago
|
Product: Firefox for Android → GeckoView
You need to log in
before you can comment on or make changes to this bug.
Description
•