mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 1928679 - Remove deprecated delegate for webextension onInstallPrompt r=geckoview-reviewers,calu
Differential Revision: https://phabricator.services.mozilla.com/D227744
This commit is contained in:
parent
143b4e05ec
commit
c3930bcfd7
@ -53,7 +53,6 @@ import java.lang.Boolean;
|
||||
import java.lang.CharSequence;
|
||||
import java.lang.Class;
|
||||
import java.lang.Comparable;
|
||||
import java.lang.Deprecated;
|
||||
import java.lang.Double;
|
||||
import java.lang.Exception;
|
||||
import java.lang.Float;
|
||||
@ -88,7 +87,6 @@ import org.mozilla.geckoview.CompositorController;
|
||||
import org.mozilla.geckoview.ContentBlocking;
|
||||
import org.mozilla.geckoview.ContentBlockingController;
|
||||
import org.mozilla.geckoview.CrashHandler;
|
||||
import org.mozilla.geckoview.DeprecationSchedule;
|
||||
import org.mozilla.geckoview.ExperimentDelegate;
|
||||
import org.mozilla.geckoview.GeckoDisplay;
|
||||
import org.mozilla.geckoview.GeckoResult;
|
||||
@ -2844,7 +2842,6 @@ package org.mozilla.geckoview {
|
||||
}
|
||||
|
||||
@UiThread public static interface WebExtensionController.PromptDelegate {
|
||||
method @Deprecated @DeprecationSchedule(id="web-extension-on-install-prompt",version=134) @Nullable default public GeckoResult<AllowOrDeny> onInstallPrompt(@NonNull WebExtension, @NonNull String[], @NonNull String[]);
|
||||
method @Nullable default public GeckoResult<WebExtension.PermissionPromptResponse> onInstallPromptRequest(@NonNull WebExtension, @NonNull String[], @NonNull String[]);
|
||||
method @Nullable default public GeckoResult<AllowOrDeny> onOptionalPrompt(@NonNull WebExtension, @NonNull String[], @NonNull String[]);
|
||||
method @Nullable default public GeckoResult<AllowOrDeny> onUpdatePrompt(@NonNull WebExtension, @NonNull WebExtension, @NonNull String[], @NonNull String[]);
|
||||
|
@ -2589,13 +2589,17 @@ class NavigationDelegateTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateUntilTestEnd(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<WebExtension.PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
WebExtension.PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -705,13 +705,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
true, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -795,12 +799,11 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Remove test when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(
|
||||
extension.metaData.description,
|
||||
"Adds a red border to all webpages matching example.com.",
|
||||
@ -819,7 +822,12 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
)
|
||||
assertEquals(extension.metaData.incognito, "spanning")
|
||||
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -1019,13 +1027,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -1103,13 +1115,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -1179,13 +1195,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 2)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -1235,13 +1255,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
) {
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 0)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -1297,13 +1321,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
)
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -1396,13 +1424,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
fun corruptFileErrorWillNotReturnAnWebExtensionWithoutId() {
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 0)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -1461,13 +1493,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.deny()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
false, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -2072,13 +2108,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
)
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -2151,13 +2191,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
val tabsExtension = sessionRule.waitForResult(
|
||||
@ -2166,13 +2210,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
var tabsExtensionPB = sessionRule.waitForResult(
|
||||
@ -3082,15 +3130,19 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(extension.metaData.version, "1.0")
|
||||
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3144,15 +3196,19 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(extension.metaData.version, "1.0")
|
||||
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3186,15 +3242,19 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(extension.metaData.version, "1.0")
|
||||
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3235,15 +3295,19 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(extension.metaData.version, "1.0")
|
||||
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3311,15 +3375,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
assertEquals(extension.metaData.version, "2.0")
|
||||
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3369,15 +3435,19 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(extension.metaData.version, "1.0")
|
||||
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3446,13 +3516,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
fun cancelInstallFailsAfterInstalled() {
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3488,14 +3562,18 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(extension.metaData.version, "1.0")
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3551,13 +3629,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3711,13 +3793,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -3791,13 +3877,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -4085,17 +4175,21 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
var addonId = ""
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny> {
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
assertEquals(extension.metaData.name, "Borderify")
|
||||
assertEquals(extension.metaData.version, "1.0")
|
||||
assertEquals(extension.isBuiltIn, false)
|
||||
addonId = extension.id
|
||||
return GeckoResult.allow()
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
@ -4226,13 +4320,17 @@ class WebExtensionTest : BaseSessionTest() {
|
||||
|
||||
sessionRule.delegateDuringNextWait(object : WebExtensionController.PromptDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
@Deprecated("Update to the new API when addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374")
|
||||
override fun onInstallPrompt(
|
||||
override fun onInstallPromptRequest(
|
||||
extension: WebExtension,
|
||||
permissions: Array<String>,
|
||||
origins: Array<String>,
|
||||
): GeckoResult<AllowOrDeny>? {
|
||||
return GeckoResult.allow()
|
||||
): GeckoResult<PermissionPromptResponse>? {
|
||||
return GeckoResult.fromValue(
|
||||
PermissionPromptResponse(
|
||||
true, // isPermissionsGranted
|
||||
false, // isPrivateModeGranted
|
||||
),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -247,29 +247,6 @@ public class WebExtensionController {
|
||||
*/
|
||||
@UiThread
|
||||
public interface PromptDelegate {
|
||||
/**
|
||||
* @deprecated Please use onInstallPromptRequest instead. Called whenever a new extension is
|
||||
* being installed. This is intended as an opportunity for the app to prompt the user for
|
||||
* the permissions required by this extension.
|
||||
* @param extension The {@link WebExtension} that is about to be installed. You can use {@link
|
||||
* WebExtension#metaData} to gather information about this extension when building the user
|
||||
* prompt dialog.
|
||||
* @param permissions The list of permissions that are granted during installation.
|
||||
* @param origins The list of origins that are granted during installation.
|
||||
* @return A {@link GeckoResult} that completes to either {@link AllowOrDeny#ALLOW ALLOW} if
|
||||
* this extension should be installed or {@link AllowOrDeny#DENY DENY} if this extension
|
||||
* should not be installed. A null value will be interpreted as {@link AllowOrDeny#DENY
|
||||
* DENY}.
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
@DeprecationSchedule(id = "web-extension-on-install-prompt", version = 134)
|
||||
default GeckoResult<AllowOrDeny> onInstallPrompt(
|
||||
@NonNull final WebExtension extension,
|
||||
@NonNull final String[] permissions,
|
||||
@NonNull final String[] origins) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever a new extension is being installed. This is intended as an opportunity for
|
||||
@ -1199,38 +1176,20 @@ public class WebExtensionController {
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
final GeckoResult<AllowOrDeny> promptResponseDeprecated =
|
||||
mPromptDelegate.onInstallPrompt(
|
||||
final GeckoResult<WebExtension.PermissionPromptResponse> promptResponse =
|
||||
mPromptDelegate.onInstallPromptRequest(
|
||||
extension, message.getStringArray("permissions"), message.getStringArray("origins"));
|
||||
// To be deleted after addressing https://bugzilla.mozilla.org/show_bug.cgi?id=1919374
|
||||
// If we get null from onInstallPrompt this means nobody has implemented it, so we proceed to
|
||||
// call the new API onInstallPromptRequest.
|
||||
if (promptResponseDeprecated != null) {
|
||||
callback.resolveTo(
|
||||
promptResponseDeprecated.map(
|
||||
allowOrDeny -> {
|
||||
final GeckoBundle response = new GeckoBundle(2);
|
||||
response.putBoolean("allow", AllowOrDeny.ALLOW.equals(allowOrDeny));
|
||||
response.putBoolean("privateBrowsingAllowed", false);
|
||||
return response;
|
||||
}));
|
||||
} else {
|
||||
final GeckoResult<WebExtension.PermissionPromptResponse> promptResponse =
|
||||
mPromptDelegate.onInstallPromptRequest(
|
||||
extension, message.getStringArray("permissions"), message.getStringArray("origins"));
|
||||
if (promptResponse == null) {
|
||||
return;
|
||||
}
|
||||
callback.resolveTo(
|
||||
promptResponse.map(
|
||||
userResponse -> {
|
||||
final GeckoBundle response = new GeckoBundle(2);
|
||||
response.putBoolean("allow", userResponse.isPermissionsGranted);
|
||||
response.putBoolean("privateBrowsingAllowed", userResponse.isPrivateModeGranted);
|
||||
return response;
|
||||
}));
|
||||
if (promptResponse == null) {
|
||||
return;
|
||||
}
|
||||
callback.resolveTo(
|
||||
promptResponse.map(
|
||||
userResponse -> {
|
||||
final GeckoBundle response = new GeckoBundle(2);
|
||||
response.putBoolean("allow", userResponse.isPermissionsGranted);
|
||||
response.putBoolean("privateBrowsingAllowed", userResponse.isPrivateModeGranted);
|
||||
return response;
|
||||
}));
|
||||
}
|
||||
|
||||
private void updatePrompt(final GeckoBundle message, final EventCallback callback) {
|
||||
|
@ -12,6 +12,8 @@ exclude: true
|
||||
# GeckoView API Changelog.
|
||||
|
||||
⚠️ breaking change and deprecation notices
|
||||
## v134
|
||||
- ⚠️ [`WebExtensionController.PromptDelegate.onInstallPrompt`][133.5] is removed see https://bugzilla.mozilla.org/show_bug.cgi?id=1919374 for more details.
|
||||
|
||||
## v133
|
||||
- Added [`GeckoSession.getWebCompatInfo`][133.1] that returns a `GeckoResult<JSONObject>` for web compatability information. ([bug 1917273]({{bugzilla}}1917273)).
|
||||
@ -1645,4 +1647,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]: 9875ec607962d0f2546febd1f589a07707f62045
|
||||
[api-version]: d56db656ed1dc11ccb79afae4de27474b9b16f87
|
||||
|
Loading…
Reference in New Issue
Block a user