Skip to content

Commit

Permalink
Call UnregisterHandler earlier for the old handler
Browse files Browse the repository at this point in the history
This makes sure we get the consistent behavior for every platform (except Android for now).

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1890560
gecko-commit: a0dbaa387380b0ef3620f706bd741ad2b376734a
gecko-reviewers: asuth, nalexander, win-reviewers, gstoll
  • Loading branch information
saschanaz authored and moz-wptsync-bot committed Feb 18, 2025
1 parent fca007b commit b35e02d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions notifications/tag.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/helpers.js"></script>
<script>
function promiseEvent(target, eventName, syncListener) {
Expand Down Expand Up @@ -44,4 +46,22 @@

await promiseCloseEvent; // This should not timeout
}, "Opening two notifications with the same tag should close the first one");

promise_test(async t => {
const events = [];

const tom1 = new Notification("New Email to tom", {
tag: "Tom"
});
t.add_cleanup(() => tom1.close());
tom1.onclose = () => events.push("tomclose");

const tom2 = new Notification("New Email to tom", {
tag: "Tom"
});
t.add_cleanup(() => tom2.close());
await promiseEvent(tom2, "show", () => events.push("tomshow"));

assert_array_equals(events, ["tomclose", "tomshow"]);
}, "Opening two notifications with the same tag should fire close event before show event");
</script>

0 comments on commit b35e02d

Please sign in to comment.