Bug 1767058 - Actually deprecate onLocationChange(2) r=ohall,calu

Differential Revision: https://phabricator.services.mozilla.com/D145120
This commit is contained in:
Agi Sferro 2022-05-05 21:33:15 +00:00
Родитель 7310469fba
Коммит fb4d7ff61c
5 изменённых файлов: 77 добавлений и 24 удалений

Просмотреть файл

@ -1079,7 +1079,7 @@ package org.mozilla.geckoview {
method @UiThread default public void onCanGoForward(@NonNull GeckoSession, boolean);
method @Nullable @UiThread default public GeckoResult<String> onLoadError(@NonNull GeckoSession, @Nullable String, @NonNull WebRequestError);
method @Nullable @UiThread default public GeckoResult<AllowOrDeny> onLoadRequest(@NonNull GeckoSession, @NonNull GeckoSession.NavigationDelegate.LoadRequest);
method @DeprecationSchedule(id="location-permissions",version=92) @UiThread default public void onLocationChange(@NonNull GeckoSession, @Nullable String);
method @Deprecated @DeprecationSchedule(id="location-permissions",version=104) @UiThread default public void onLocationChange(@NonNull GeckoSession, @Nullable String);
method @UiThread default public void onLocationChange(@NonNull GeckoSession, @Nullable String, @NonNull List<GeckoSession.PermissionDelegate.ContentPermission>);
method @Nullable @UiThread default public GeckoResult<GeckoSession> onNewSession(@NonNull GeckoSession, @NonNull String);
method @Nullable @UiThread default public GeckoResult<AllowOrDeny> onSubframeLoadRequest(@NonNull GeckoSession, @NonNull GeckoSession.NavigationDelegate.LoadRequest);

Просмотреть файл

@ -99,7 +99,10 @@ class NavigationDelegateTest : BaseSessionTest() {
if (errorPageUrl != null) {
sessionRule.waitUntilCalled(object : ContentDelegate, NavigationDelegate {
@AssertCalled(count = 1, order = [1])
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, equalTo(testLoader.getUri()))
}
@ -558,7 +561,10 @@ class NavigationDelegateTest : BaseSessionTest() {
sessionRule.waitUntilCalled(object : ContentDelegate, NavigationDelegate {
@AssertCalled(count = 1, order = [1])
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, equalTo(httpsUri))
}
@ -1226,7 +1232,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1, order = [2])
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("Session should not be null", session, notNullValue())
assertThat("URL should not be null", url, notNullValue())
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
@ -1261,7 +1270,10 @@ class NavigationDelegateTest : BaseSessionTest() {
sessionRule.forCallbacksDuringWait(object : NavigationDelegate, ProgressDelegate {
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match the provided data URL", url, equalTo(dataUrl))
}
@ -1293,7 +1305,10 @@ class NavigationDelegateTest : BaseSessionTest() {
// Test that if we unset the navigation delegate during a load, the load still proceeds.
var onLocationCount = 0
mainSession.navigationDelegate = object : NavigationDelegate {
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
onLocationCount++
}
}
@ -1327,7 +1342,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should be a data URL", url,
equalTo(createDataUri(dataString, mimeType)))
}
@ -1345,7 +1363,10 @@ class NavigationDelegateTest : BaseSessionTest() {
sessionRule.forCallbacksDuringWait(object : NavigationDelegate, ProgressDelegate {
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should be a data URL", url, startsWith("data:"))
}
@ -1373,7 +1394,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, equalTo(createDataUri(bytes, "text/html")))
}
@ -1404,7 +1428,10 @@ class NavigationDelegateTest : BaseSessionTest() {
sessionRule.forCallbacksDuringWait(object : NavigationDelegate, ProgressDelegate {
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, equalTo(createDataUri(bytes, mimeType)))
}
@ -1450,7 +1477,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1, order = [2])
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
}
@ -1483,7 +1513,10 @@ class NavigationDelegateTest : BaseSessionTest() {
sessionRule.forCallbacksDuringWait(object : NavigationDelegate {
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?, perms : MutableList<PermissionDelegate.ContentPermission>) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH))
}
})
@ -1502,7 +1535,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1, order = [2])
override fun onLocationChange(session: GeckoSession, url: String?, perms : MutableList<PermissionDelegate.ContentPermission>) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, endsWith(HELLO_HTML_PATH))
}
@ -1536,7 +1572,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1, order = [2])
override fun onLocationChange(session: GeckoSession, url: String?, perms : MutableList<PermissionDelegate.ContentPermission>) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URL should match", url, endsWith(HELLO2_HTML_PATH))
}
@ -2220,7 +2259,10 @@ class NavigationDelegateTest : BaseSessionTest() {
var currentUrl: String? = null
mainSession.delegateUntilTestEnd(object: NavigationDelegate {
override fun onLocationChange(session: GeckoSession, url: String?) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
currentUrl = url
}
@ -2301,7 +2343,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?, perms : MutableList<PermissionDelegate.ContentPermission>) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URI should match", url, endsWith("#test1"))
}
})
@ -2317,7 +2362,10 @@ class NavigationDelegateTest : BaseSessionTest() {
}
@AssertCalled(count = 1)
override fun onLocationChange(session: GeckoSession, url: String?, perms : MutableList<PermissionDelegate.ContentPermission>) {
override fun onLocationChange(
session: GeckoSession,
url: String?,
perms: MutableList<PermissionDelegate.ContentPermission>) {
assertThat("URI should match", url, endsWith("#test2"))
}
})

Просмотреть файл

@ -3636,7 +3636,8 @@ public class GeckoSession {
* @param url The resource being loaded.
*/
@UiThread
@DeprecationSchedule(id = "location-permissions", version = 92)
@Deprecated
@DeprecationSchedule(id = "location-permissions", version = 104)
default void onLocationChange(
@NonNull final GeckoSession session, @Nullable final String url) {}

Просмотреть файл

@ -16,9 +16,12 @@ exclude: true
## v102
- Added [`DateTimePrompt.stepValue`][102.1] to export [`step`][102.2] attribute of input element.
([bug 1499635]({{bugzilla}}1499635))
- Deprecated [`onLocationChange(2)`][102.3], please use [`onLocationChange(3)`][102.4].
[102.1]: {{javadoc_uri}}/GeckoSession.PromptDelegate.DateTimePrompt.html#stepValue
[102.2]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#step
[102.3]: {{javadoc_uri}}/GeckoSession.NavigationDelegate.html#onLocationChange(org.mozilla.geckoview.GeckoSession,java.lang.String)
[102.4]: {{javadoc_uri}}/GeckoSession.NavigationDelegate.html#onLocationChange(org.mozilla.geckoview.GeckoSession,java.lang.String,java.util.List)
## v101
- Added [`GeckoDisplay.surfaceChanged`][101.1] function taking new type [`GeckoDisplay.SurfaceInfo`][101.2].
@ -1173,4 +1176,4 @@ to allow adding gecko profiler markers.
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport(android.content.Context,android.os.Bundle,java.lang.String)
[65.25]: {{javadoc_uri}}/GeckoResult.html
[api-version]: 2e222c719dbf147894067f5035682b205aefc2fb
[api-version]: 036203b3b292abd94071762009cf965908e40f04

Просмотреть файл

@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.ContentBlocking;
@ -21,6 +22,7 @@ import org.mozilla.geckoview.GeckoResult;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoRuntimeSettings;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoSession.PermissionDelegate.ContentPermission;
import org.mozilla.geckoview.GeckoSessionSettings;
import org.mozilla.geckoview.GeckoView;
import org.mozilla.geckoview.OrientationController;
@ -98,10 +100,8 @@ public class TestRunnerActivity extends Activity {
new GeckoSession.PermissionDelegate() {
@Override
public GeckoResult<Integer> onContentPermissionRequest(
@NonNull final GeckoSession session,
@NonNull GeckoSession.PermissionDelegate.ContentPermission perm) {
return GeckoResult.fromValue(
GeckoSession.PermissionDelegate.ContentPermission.VALUE_ALLOW);
@NonNull final GeckoSession session, @NonNull ContentPermission perm) {
return GeckoResult.fromValue(ContentPermission.VALUE_ALLOW);
}
@Override
@ -153,7 +153,8 @@ public class TestRunnerActivity extends Activity {
private GeckoSession.NavigationDelegate mNavigationDelegate =
new GeckoSession.NavigationDelegate() {
@Override
public void onLocationChange(final GeckoSession session, final String url) {
public void onLocationChange(
final GeckoSession session, final String url, final List<ContentPermission> perms) {
getActionBar().setSubtitle(url);
}