@@ -1680,16 +1680,12 @@ <h2>
1680
1680
associated with |subscription| and the process described in [[RFC8291]]. Set |bytes|
1681
1681
to the resulting [=/byte sequence=].
1682
1682
</ li >
1683
- < li > If the < a > push message</ a > payload could not be decrypted for any reason:
1684
- < ol >
1685
- < li > Acknowledge the receipt of the < a > push message</ a > according to [[RFC8030]].
1686
- Though the message was not successfully received and processed, this prevents the
1687
- push service from attempting to retransmit the message; a badly encrypted message
1688
- is not recoverable.
1689
- </ li >
1690
- < li > Abort these steps.
1691
- </ li >
1692
- </ ol >
1683
+ < li >
1684
+ < p >
1685
+ If the < a > push message</ a > payload could not be decrypted for any reason, then
1686
+ [=acknowledge a push message|acknowledge=] the < a > push message</ a > and abort
1687
+ these steps.
1688
+ </ p >
1693
1689
< p class ="note ">
1694
1690
A `push` event is not fired for a < a > push message</ a > that was not successfully
1695
1691
decrypted using the key pair associated with the < a > push subscription</ a > .
@@ -1740,6 +1736,16 @@ <h2>
1740
1736
|registration|.
1741
1737
</ p >
1742
1738
</ li >
1739
+ < li >
1740
+ < p >
1741
+ Let |notificationShown| be false.
1742
+ </ p >
1743
+ </ li >
1744
+ < li >
1745
+ < p >
1746
+ Let |appBadgeSet| be false.
1747
+ </ p >
1748
+ </ li >
1743
1749
< li >
1744
1750
< p >
1745
1751
If |declarativeResult|'s [=declarative push message parser result/mutable=]
@@ -1748,65 +1754,86 @@ <h2>
1748
1754
< ol >
1749
1755
< li >
1750
1756
< p >
1751
- [=/Fire a functional event=] named "`push`" using {{PushEvent}} on
1752
- |registration| with the following properties:
1753
- </ p >
1754
- < dl >
1755
- < dt >
1756
- {{PushEvent/data}}
1757
- </ dt >
1758
- < dd >
1759
- null
1760
- </ dd >
1761
- < dt >
1762
- {{PushEvent/notification}}
1763
- </ dt >
1764
- < dd >
1765
- |notification|
1766
- </ dd >
1767
- < dt >
1768
- {{PushEvent/appBadge}}
1769
- </ dt >
1770
- < dd >
1771
- |declarativeResult|'s [=declarative push message parser result/app
1772
- badge=]
1773
- </ dd >
1774
- </ dl >
1775
- </ li >
1776
- < li >
1777
- < p >
1778
- Wait for all of the promises in the [=ExtendableEvent/extend lifetime
1779
- promises=] of the dispatched event to resolve.
1757
+ Let |result| be the result of [=fire a push event|firing a push event=]
1758
+ given |registration|, null, a new {{Notification}} object representing
1759
+ |notification|, and |declarativeResult|'s [=declarative push message
1760
+ parser result/app badge=].
1780
1761
</ p >
1781
1762
</ li >
1782
1763
< li >
1783
1764
< p >
1784
- If a notification has been shown through
1785
- {{ServiceWorkerRegistration/showNotification()}} at this point, then
1786
- abort these steps .
1765
+ If |result| is not failure, then set |notificationShown| to |result|'s
1766
+ [=push event result/notification shown=] and |appBadgeSet| to [=push
1767
+ event result/app badge set=] .
1787
1768
</ p >
1788
1769
</ li >
1789
1770
</ ol >
1790
1771
</ li >
1791
1772
< li >
1792
1773
< p >
1793
- Run the [=notification show steps=] given |notification|.
1774
+ If |notificationShown| is false, then run the [=notification show steps=]
1775
+ given |notification|.
1794
1776
</ p >
1795
1777
</ li >
1796
1778
< li >
1797
1779
< p >
1798
- < a href ="https://github.com/w3c/badging/issues/111 "> w3c/badging #111</ a >
1780
+ If |appBadgeSet| is false, then < a href =
1781
+ "https://github.com/w3c/badging/issues/111 "> w3c/badging #111</ a > ...
1799
1782
</ p >
1800
1783
</ li >
1801
1784
< li >
1802
1785
< p >
1803
- Abort these steps.
1786
+ [=acknowledge a push message|Acknowledge=] the < a > push message</ a > and abort
1787
+ these steps.
1804
1788
</ p >
1805
1789
</ li >
1806
1790
</ ol >
1807
1791
</ li >
1808
1792
</ ol >
1809
1793
</ li >
1794
+ < li >
1795
+ < p >
1796
+ Let |result| be the result of [=fire a push event|firing a push event=] given
1797
+ |registration|, a new {{PushMessageData}} instance whose [=PushMessageData/bytes=] is
1798
+ |bytes|, null, and null.
1799
+ </ p >
1800
+ </ li >
1801
+ < li >
1802
+ < p >
1803
+ If < var > result</ var > is failure and the same < a > push message</ a > has been delivered
1804
+ to a < a > service worker registration</ a > multiple times unsuccessfully, then
1805
+ [=acknowledge a push message|acknowledge=] the < a > push message</ a > .
1806
+ </ p >
1807
+ </ li >
1808
+ < li >
1809
+ < p >
1810
+ If < var > result</ var > is not failure, then [=acknowledge a push message|acknowledge=]
1811
+ the < a > push message</ a > .
1812
+ </ p >
1813
+ </ li >
1814
+ </ ol >
1815
+ < p >
1816
+ A < dfn > push event result</ dfn > is a [=/tuple=] consisting of a < dfn for =
1817
+ "push event result "> notification shown</ dfn > (a [=/boolean=]) and a < dfn for =
1818
+ "push event result "> app badge set</ dfn > (a [=/boolean=]).
1819
+ </ p >
1820
+ < p >
1821
+ To < dfn > fire a push event</ dfn > given a [=/service worker registration=] |registration|,
1822
+ {{PushMessageData}} object or null |data|, a [=/notification=] or null |notification|,
1823
+ and an integer or null |appBadge|, run these steps. They return failure or a [=/push
1824
+ event result=].
1825
+ </ p >
1826
+ < ol >
1827
+ < li >
1828
+ < p >
1829
+ Let |notificationResult| be null.
1830
+ </ p >
1831
+ </ li >
1832
+ < li >
1833
+ < p >
1834
+ Let |appBadgeResult| be null.
1835
+ </ p >
1836
+ </ li >
1810
1837
< li >
1811
1838
< p >
1812
1839
< a > Fire a functional event</ a > named "`push`" using < a > PushEvent</ a > on
@@ -1817,53 +1844,89 @@ <h2>
1817
1844
{{PushEvent//data}}
1818
1845
</ dt >
1819
1846
< dd >
1820
- A new {{PushMessageData}} instance whose [=PushMessageData/bytes=] is |bytes|.
1847
+ |data|
1821
1848
</ dd >
1822
1849
< dt >
1823
1850
{{PushEvent/notification}}
1824
1851
</ dt >
1825
1852
< dd >
1826
- null
1853
+ |notification|
1827
1854
</ dd >
1828
1855
< dt >
1829
1856
{{PushEvent/appBadge}}
1830
1857
</ dt >
1831
1858
< dd >
1832
- null
1859
+ |appBadge|
1833
1860
</ dd >
1834
1861
</ dl >
1835
1862
< p >
1836
1863
Then run the following steps in parallel, with |dispatchedEvent|:
1837
1864
</ p >
1838
1865
< ol >
1839
- < li > Wait for all of the promises in the [=ExtendableEvent/extend lifetime promises=]
1840
- of |dispatchedEvent| to resolve.
1841
- </ li >
1842
- < li > If all the promises resolve successfully, acknowledge the receipt of the < a > push
1843
- message </ a > according to [[RFC8030]] and abort these steps.
1866
+ < li >
1867
+ < p >
1868
+ Wait for all of the promises in the [=ExtendableEvent/extend lifetime promises=]
1869
+ of |dispatchedEvent| to resolve.
1870
+ </ p >
1844
1871
</ li >
1845
1872
< li >
1846
1873
< p >
1847
- If the same < a > push message</ a > has been delivered to a < a > service worker
1848
- registration</ a > multiple times unsuccessfully, acknowledge the receipt of the
1849
- < a > push message</ a > according to [[RFC8030]].
1874
+ If they do not resolve successfully, then set |notificationResult| and
1875
+ |appBadgeResult| to failure and abort these steps.
1850
1876
</ p >
1877
+ </ li >
1878
+ < li >
1851
1879
< p >
1852
- Acknowledging the < a > push message</ a > causes the < a > push service</ a > to stop
1853
- delivering the message and to report success to the < a > application server</ a > .
1854
- This prevents the same < a > push message</ a > from being retried by the < a > push
1855
- service</ a > indefinitely.
1880
+ Set |notificationResult| to true if
1881
+ {{ServiceWorkerRegistration/showNotification()}} has been invoked; otherwise
1882
+ false.
1856
1883
</ p >
1884
+ </ li >
1885
+ < li >
1857
1886
< p >
1858
- Acknowledging also means that an < a > application server</ a > could incorrectly
1859
- receive a delivery receipt indicating successful delivery of the < a > push
1860
- message</ a > . Therefore, multiple rejections SHOULD be permitted before
1861
- acknowledging; allowing at least three attempts is recommended.
1887
+ Set |appBadgeResult| to true if {{NavigatorBadge/setAppBadge()}} has been
1888
+ invoked; otherwise false.
1862
1889
</ p >
1863
1890
</ li >
1864
1891
</ ol >
1865
1892
</ li >
1893
+ < li >
1894
+ < p >
1895
+ Wait for |notificationResult| and |appBadgeResult| to be non-null.
1896
+ </ p >
1897
+ </ li >
1898
+ < li >
1899
+ < p >
1900
+ If |notificationResult| is failure, then return failure.
1901
+ </ p >
1902
+ </ li >
1903
+ < li >
1904
+ < p >
1905
+ [=/Assert=]: |notificationResult| and |appBadgeResult| are [=/booleans=].
1906
+ </ p >
1907
+ </ li >
1908
+ < li >
1909
+ < p >
1910
+ Return (|notificationResult|, |appBadgeResult|).
1911
+ </ p >
1912
+ </ li >
1866
1913
</ ol >
1914
+ < p >
1915
+ To < dfn > acknowledge a push message</ dfn > given a < a > push message</ a >
1916
+ < var > pushMessage</ var > means to acknowledge the receipt of < var > pushMessage</ var >
1917
+ according to [[RFC8030]].
1918
+ </ p >
1919
+ < p >
1920
+ Acknowledging the < a > push message</ a > causes the < a > push service</ a > to stop delivering
1921
+ the message and to report success to the < a > application server</ a > . This prevents the
1922
+ same < a > push message</ a > from being retried by the < a > push service</ a > indefinitely.
1923
+ </ p >
1924
+ < p >
1925
+ Acknowledging also means that an < a > application server</ a > could incorrectly receive a
1926
+ delivery receipt indicating successful delivery of the < a > push message</ a > . Therefore,
1927
+ multiple rejections SHOULD be permitted before acknowledging; allowing at least three
1928
+ attempts is recommended.
1929
+ </ p >
1867
1930
</ section >
1868
1931
< section >
1869
1932
< h2 >
0 commit comments