Skip to content

Commit

Permalink
Backed out changeset d52680bbda73 (bug 1642345) for Mochitest failure…
Browse files Browse the repository at this point in the history
…s in toolkit/components/alerts/test/test_alerts_noobserve.html. CLOSED TREE
  • Loading branch information
dgluca committed Jun 8, 2020
1 parent 08c0b16 commit c949459
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 24 deletions.
1 change: 0 additions & 1 deletion mobile/android/geckoview/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,6 @@ package org.mozilla.geckoview {
field @Nullable public final String imageUrl;
field @Nullable public final String lang;
field @NonNull public final boolean requireInteraction;
field @NonNull public final String source;
field @NonNull public final String tag;
field @Nullable public final String text;
field @Nullable public final String textDirection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class WebNotificationTest : BaseSessionTest() {
assertThat("Direction should match", notification.textDirection, equalTo("ltr"))
assertThat("Require Interaction should match", notification.requireInteraction,
equalTo(requireInteraction))
assertThat("Source should match", notification.source, equalTo(createTestUrl(HELLO_HTML_PATH)))
notificationResult.complete(null)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.mozilla.geckoview.*
import org.mozilla.geckoview.test.rule.GeckoSessionTestRule
import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.RejectedPromiseException
import org.mozilla.geckoview.test.util.Callbacks
import java.math.BigInteger
import java.security.KeyPair
import java.security.KeyPairGenerator
import java.security.SecureRandom
Expand Down Expand Up @@ -168,7 +169,6 @@ class WebPushTest : BaseSessionTest() {
override fun onShowNotification(notification: WebNotification) {
assertThat("Title should match", notification.title, equalTo(expectedTitle))
assertThat("Body should match", notification.text, equalTo(expectedBody))
assertThat("Source should match", notification.source, endsWith("sw.js"))
notificationResult.complete(null)
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,11 @@ public class WebNotification {
*/
public final @NonNull boolean requireInteraction;

/**
* This is the URL of the page or Service Worker that generated the notification.
*/
public final @NonNull String source;

@WrapForJNI
/* package */ WebNotification(@Nullable final String title, @NonNull final String tag,
@Nullable final String cookie, @Nullable final String text,
@Nullable final String imageUrl, @Nullable final String textDirection,
@Nullable final String lang, @NonNull final boolean requireInteraction,
@NonNull final String source) {
@Nullable final String lang, @NonNull final boolean requireInteraction) {
this.tag = tag;
this.mCookie = cookie;
this.title = title;
Expand All @@ -93,7 +87,6 @@ public class WebNotification {
this.textDirection = textDirection;
this.lang = lang;
this.requireInteraction = requireInteraction;
this.source = source;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ exclude: true
- Added `runtime.openOptionsPage` support. For `options_ui.open_in_new_tab` ==
`false`, [`TabDelegate.onOpenOptionsPage`][79.1] is called.
([bug 1618058]({{bugzilla}}1619766))
- Added [`WebNotification.source`][79.2], which is the URL of the page
or Service Worker that created the notification.


[79.1]: {{javadoc_uri}}/WebExtension.TabDelegate.html#onOpenOptionsPage-org.mozilla.geckoview.WebExtension-
[79.2]: {{javadoc_uri}}/WebNotification.html#source

## v78
- Added [`WebExtensionController.installBuiltIn`][78.1] that allows installing an
Expand Down Expand Up @@ -723,4 +719,4 @@ exclude: true
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
[65.25]: {{javadoc_uri}}/GeckoResult.html

[api-version]: 820c4bbc052bd8b8b19c2460c3996b86e1786ff7
[api-version]: c75d02b7653f49b0d301d95a50f6d559dca1c48c
14 changes: 6 additions & 8 deletions widget/android/AndroidAlerts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "AndroidAlerts.h"
#include "mozilla/java/GeckoRuntimeWrappers.h"
#include "mozilla/java/WebNotificationWrappers.h"
#include "nsIPrincipal.h"
#include "nsIURI.h"
#include "nsAlertsUtils.h"

namespace mozilla {
namespace widget {
Expand Down Expand Up @@ -77,13 +76,12 @@ AndroidAlerts::ShowPersistentNotification(const nsAString& aPersistentData,
rv = aAlert->GetRequireInteraction(&requireInteraction);
NS_ENSURE_SUCCESS(rv, NS_OK);

nsCOMPtr<nsIURI> uri;
rv = aAlert->GetURI(getter_AddRefs(uri));
nsCOMPtr<nsIPrincipal> principal;
rv = aAlert->GetPrincipal(getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, NS_OK);

nsCString spec;
rv = uri->GetDisplaySpec(spec);
NS_ENSURE_SUCCESS(rv, NS_OK);
nsAutoString host;
nsAlertsUtils::GetSourceHostPort(principal, host);

if (aPersistentData.IsEmpty() && aAlertListener) {
if (!sListenerMap) {
Expand All @@ -94,7 +92,7 @@ AndroidAlerts::ShowPersistentNotification(const nsAString& aPersistentData,
}

java::WebNotification::LocalRef notification = notification->New(
title, name, cookie, text, imageUrl, dir, lang, requireInteraction, spec);
title, name, cookie, text, imageUrl, dir, lang, requireInteraction);
java::GeckoRuntime::LocalRef runtime = java::GeckoRuntime::GetInstance();
if (runtime != NULL) {
runtime->NotifyOnShow(notification);
Expand Down

0 comments on commit c949459

Please sign in to comment.