Bug 1614990 - Update WebPushController.onSubscriptionChanged to take only the scope. r=snorp

Differential Revision: https://phabricator.services.mozilla.com/D62607

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Almeida [:jonalmeida] 2020-02-12 17:15:37 +00:00
Родитель c03acee173
Коммит 9942b0ab5a
5 изменённых файлов: 10 добавлений и 8 удалений

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

@ -1655,7 +1655,7 @@ package org.mozilla.geckoview {
public class WebPushController { public class WebPushController {
method @UiThread public void onPushEvent(@NonNull String); method @UiThread public void onPushEvent(@NonNull String);
method @UiThread public void onPushEvent(@NonNull String, @Nullable byte[]); method @UiThread public void onPushEvent(@NonNull String, @Nullable byte[]);
method @UiThread public void onSubscriptionChanged(@NonNull WebPushSubscription); method @UiThread public void onSubscriptionChanged(@NonNull String);
method @UiThread public void setDelegate(@Nullable WebPushDelegate); method @UiThread public void setDelegate(@Nullable WebPushDelegate);
} }

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

@ -159,7 +159,7 @@ class WebPushTest : BaseSessionTest() {
val p = mainSession.evaluatePromiseJS("window.doWaitForSubscriptionChange()") val p = mainSession.evaluatePromiseJS("window.doWaitForSubscriptionChange()")
sessionRule.runtime.webPushController.onSubscriptionChanged(delegate!!.storedSubscription!!) sessionRule.runtime.webPushController.onSubscriptionChanged(delegate!!.storedSubscription!!.scope)
assertThat("Result should not be null", p.value, notNullValue()) assertThat("Result should not be null", p.value, notNullValue())
} }

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

@ -71,14 +71,14 @@ public class WebPushController {
* Notify that a given subscription has changed. This is normally a signal to the content * Notify that a given subscription has changed. This is normally a signal to the content
* that it needs to re-subscribe. * that it needs to re-subscribe.
* *
* @param subscription The subscription that changed. * @param scope The Service Worker scope associated with this subscription.
*/ */
@UiThread @UiThread
public void onSubscriptionChanged(final @NonNull WebPushSubscription subscription) { public void onSubscriptionChanged(final @NonNull String scope) {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
final GeckoBundle msg = new GeckoBundle(1); final GeckoBundle msg = new GeckoBundle(1);
msg.putBundle("subscription", subscription.toBundle()); msg.putString("scope", scope);
EventDispatcher.getInstance().dispatch("GeckoView:PushSubscriptionChanged", msg); EventDispatcher.getInstance().dispatch("GeckoView:PushSubscriptionChanged", msg);
} }

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

@ -51,6 +51,7 @@ exclude: true
which is the addon metadata necessary to show their option pages. which is the addon metadata necessary to show their option pages.
([bug 1598792]({{bugzilla}}1598792)) ([bug 1598792]({{bugzilla}}1598792))
- Added [`WebExtensionController.update`][74.16] to update extensions. ([bug 1599581]({{bugzilla}}1599581)) - Added [`WebExtensionController.update`][74.16] to update extensions. ([bug 1599581]({{bugzilla}}1599581))
- ⚠️ Replaced `subscription` argument in [`WebPushDelegate.onSubscriptionChanged`][74.17] from a [`WebPushSubscription`][74.18] to the [`String`][74.19] `scope`.
[74.1]: {{javadoc_uri}}/WebExtensionController.html#enable-org.mozilla.geckoview.WebExtension-int- [74.1]: {{javadoc_uri}}/WebExtensionController.html#enable-org.mozilla.geckoview.WebExtension-int-
[74.2]: {{javadoc_uri}}/WebExtensionController.html#disable-org.mozilla.geckoview.WebExtension-int- [74.2]: {{javadoc_uri}}/WebExtensionController.html#disable-org.mozilla.geckoview.WebExtension-int-
@ -68,6 +69,9 @@ exclude: true
[74.14]: {{javadoc_uri}}/WebExtension.MetaData.html#optionsUrl [74.14]: {{javadoc_uri}}/WebExtension.MetaData.html#optionsUrl
[74.15]: {{javadoc_uri}}/WebExtension.MetaData.html#openOptionsPageInTab [74.15]: {{javadoc_uri}}/WebExtension.MetaData.html#openOptionsPageInTab
[74.16]: {{javadoc_uri}}/WebExtensionController.html#update-org.mozilla.geckoview.WebExtension-int- [74.16]: {{javadoc_uri}}/WebExtensionController.html#update-org.mozilla.geckoview.WebExtension-int-
[74.17]: {{javadoc_uri}}/WebPushController.html#onSubscriptionChange-org.mozilla.geckoview.WebPushSubscription-byte:A-
[74.18]: {{javadoc_uri}}/WebPushSubscription.html
[74.19]: https://developer.android.com/reference/java/lang/String
## v73 ## v73
- Added [`WebExtensionController.install`][73.1] and [`uninstall`][73.2] to - Added [`WebExtensionController.install`][73.1] and [`uninstall`][73.2] to

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

@ -60,9 +60,7 @@ const GeckoViewPushController = {
break; break;
} }
case "GeckoView:PushSubscriptionChanged": { case "GeckoView:PushSubscriptionChanged": {
const { const { scope } = aData;
subscription: { scope },
} = aData;
const [url, principal] = createScopeAndPrincipal(scope); const [url, principal] = createScopeAndPrincipal(scope);