Fixed
Status Update
Comments
mi...@google.com <mi...@google.com>
ha...@google.com <ha...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ha...@google.com <ha...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
ha...@google.com <ha...@google.com> #4
I won't be able to work on this until I get back from vacation in May. lais@ or ntfschr@ feel free to pick it up if you have any free cycles to spare otherwise, I will try to work on it first thing when I come back.
nt...@google.com <nt...@google.com>
nt...@google.com <nt...@google.com> #5
I believe setDomain()
or setHttpAllowed()
but it does matter for multiple addPathHandler()
calls).
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit 3fafde1b853f8c8155e05d6fcea554af0b11d9a6
Author: Nate Fischer <ntfschr@google.com>
Date: Fri Apr 02 12:45:41 2021
AndroidX Webkit: fix ordering issues on AssetLoader.Builder
We observed some WebViewAssetLoader.Builder methods are order-dependent
in a surprising way. This fixes the builder to no longer care about the
ordering of setDomain and setHttpAllowed in relation to addPathHandler
calls. This adds two tests for this case.
There are still good use cases for addPathHandler() calls to be
order-dependent. I noticed this wasn't actually covered by any
integration tests, so I added one to cover this case as well. I updated
addPathHandler's javadoc to clarify that order matters, although this
was already documented on the PathHandler interface javadoc.
Fixes: 182196765
Test: ./gradlew :webkit:webkit:connectedAndroidTest
Relnote: "Fixed a bug where WebViewAssetLoader.Builder methods were
unintentionally order-dependent."
Change-Id: If420d559a21ea624b2a493d09550ed496ffee392
M webkit/webkit/src/androidTest/java/androidx/webkit/WebViewAssetLoaderTest.java
M webkit/webkit/src/main/java/androidx/webkit/WebViewAssetLoader.java
https://android-review.googlesource.com/1663126
Branch: androidx-main
commit 3fafde1b853f8c8155e05d6fcea554af0b11d9a6
Author: Nate Fischer <ntfschr@google.com>
Date: Fri Apr 02 12:45:41 2021
AndroidX Webkit: fix ordering issues on AssetLoader.Builder
We observed some WebViewAssetLoader.Builder methods are order-dependent
in a surprising way. This fixes the builder to no longer care about the
ordering of setDomain and setHttpAllowed in relation to addPathHandler
calls. This adds two tests for this case.
There are still good use cases for addPathHandler() calls to be
order-dependent. I noticed this wasn't actually covered by any
integration tests, so I added one to cover this case as well. I updated
addPathHandler's javadoc to clarify that order matters, although this
was already documented on the PathHandler interface javadoc.
Fixes: 182196765
Test: ./gradlew :webkit:webkit:connectedAndroidTest
Relnote: "Fixed a bug where WebViewAssetLoader.Builder methods were
unintentionally order-dependent."
Change-Id: If420d559a21ea624b2a493d09550ed496ffee392
M webkit/webkit/src/androidTest/java/androidx/webkit/WebViewAssetLoaderTest.java
M webkit/webkit/src/main/java/androidx/webkit/WebViewAssetLoader.java
Description
I was playing around with AssetLoader and I found that the order of builder arguments matters. I found this extremely surprising, and this is not the normal convention for builders. As an example, here are two pieces of Java code which do different things:
The issue is we dereference thehttps://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:webkit/webkit/src/main/java/androidx/webkit/WebViewAssetLoader.java;l=526;drc=764112d6d736023c63322b262bec9c93e67786ca
mDomain
whenaddPathHandler
is called, but we really should wait until.build()
is called. Same problem withmHttpAllowed
. See