Hey folks,

If you don’t use ContentDelegate.OnExternalResponse API in your app, you can 
stop reading.

We recently landed a replacement for the current OnExternalResponse API. It has 
the same name, but its signature is different: instead of WebResponseInfo 
object (containing some metadata about the web response) it will be accepting a 
WebResponse object (containing the full web response) as one of its arguments. 
[1][2] The new endpoint will be available in GeckoView 82.

The new endpoint has a few advantages:
It prevents download bugs that can take place due to the loss of the metadata 
(such as cookies) between the two requests the apps currently have to do. 
[3][4] These bugs are often hard to hunt down and fix.
It improves efficiency  of downloads, as now only single request is needed.

Endpoints comparison:
Old endpoint: 
If the browser determined that the web response it received is a download, 
GeckoView would obtain some metadata from the web response and send it to the 
consumer app via the old ContentDelegate.OnExternalResponse. 
The app would then need to create a new web request using the metadata and 
perform the download using GeckoView Webexecutor, Android DownloadManager, or 
similar.
The app would then need to read the web response obtained by GeckoView 
Webexecutor or Android DownloadManager and store the file.
New endpoint:  
If the browser determined that the web response it received is a download, 
GeckoView would obtain the web response in its entirety and send it to the 
consumer app via the new ContentDelegate.OnExternalResponse. 
The app would then need to read the contents of the download from the 
WebResponse object and store the file.

To migrate:
Update your code to read the web response straight from 
ContentDelegate.OnExternalResponse.
You no longer need GeckoView WebExecutor or Android DownloadManager.

The old endpoint will be deprecated in GeckoView 82 and will be removed in 
GeckoView 85.

If you have any questions, feel free to ping me and the rest of the GeckoView 
team on Matrix `https://chat.mozilla.org/#/room/#geckoview:mozilla.org`

Cheers,

owlish




[1] 
https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.ContentDelegate.html#onExternalResponse-org.mozilla.geckoview.GeckoSession-org.mozilla.geckoview.WebResponse-
 
<https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.ContentDelegate.html#onExternalResponse-org.mozilla.geckoview.GeckoSession-org.mozilla.geckoview.WebResponse->
 
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1530022 
<https://bugzilla.mozilla.org/show_bug.cgi?id=1530022>
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1641586 
<https://bugzilla.mozilla.org/show_bug.cgi?id=1641586>
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1652856 
<https://bugzilla.mozilla.org/show_bug.cgi?id=1652856>
_______________________________________________
mobile-firefox-dev mailing list
mobile-firefox-dev@mozilla.org
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to