Bug 1197998 - Use counters for Push subscribe, unsubscribe and permission query. r=froydnj,kitcambridge,jst
authorNikhil Marathe <nsm.nikhil@gmail.com>
Thu, 03 Sep 2015 17:54:59 -0700
changeset 291226 2fd91dc12a4219ac7d7631455774a31483d85cb4
parent 291225 ce582bee57cb1a7a81303dc3b41289c01345b06a
child 291227 69b07795c5fa8718d7119eb7c0319318edf66d7f
push id5231
push useratolfsen@mozilla.com
push dateWed, 09 Sep 2015 14:01:39 +0000
reviewersfroydnj, kitcambridge, jst
bugs1197998
milestone43.0a1
Bug 1197998 - Use counters for Push subscribe, unsubscribe and permission query. r=froydnj,kitcambridge,jst Counters do not currently work on Web Workers, so it a no-op on non main thread.
dom/base/UseCounters.conf
dom/webidl/PushManager.webidl
dom/webidl/PushSubscription.webidl
--- a/dom/base/UseCounters.conf
+++ b/dom/base/UseCounters.conf
@@ -37,8 +37,12 @@
 // dependencies were correct would have been rather difficult, and
 // annotating the WebIDL files does nothing for identifying CSS
 // property usage, which we would also like to track.
 
 method SVGSVGElement.getElementById
 attribute SVGSVGElement.currentScale
 property Fill
 property FillOpacity
+
+// Push API
+method PushManager.subscribe
+method PushSubscription.unsubscribe
--- a/dom/webidl/PushManager.webidl
+++ b/dom/webidl/PushManager.webidl
@@ -22,17 +22,17 @@ interface PushManagerImpl {
     [Func="ServiceWorkerRegistration::WebPushMethodHider"] void setScope(DOMString scope);
 };
 
 [Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled"]
 interface PushManager {
   [ChromeOnly, Throws, Exposed=Window]
   void setPushManagerImpl(PushManagerImpl store);
 
-  [Throws]
+  [Throws, UseCounter]
   Promise<PushSubscription>     subscribe();
   [Throws]
   Promise<PushSubscription?>    getSubscription();
   [Throws]
   Promise<PushPermissionState> permissionState();
 };
 
 enum PushPermissionState
--- a/dom/webidl/PushSubscription.webidl
+++ b/dom/webidl/PushSubscription.webidl
@@ -9,16 +9,16 @@
 
 interface Principal;
 
 [Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled",
  ChromeConstructor(DOMString pushEndpoint, DOMString scope)]
 interface PushSubscription
 {
     readonly attribute USVString endpoint;
-    [Throws]
+    [Throws, UseCounter]
     Promise<boolean> unsubscribe();
     jsonifier;
 
     // Used to set the principal from the JS implemented PushManager.
     [Exposed=Window,ChromeOnly]
     void setPrincipal(Principal principal);
 };