Bug 1156052 - Add push information to about:serviceworkers. r=baku
authorDoug Turner <doug.turner@gmail.com>
Tue, 21 Apr 2015 20:10:51 +0200
changeset 240230 a5eee04c796e4611019c5ce9bc634b9fb2ad341d
parent 240229 82ea538860bc62a2a03143068bf375d12d03a20f
child 240231 6f7ff9108025932601de3b1bee9412704b54af91
push id58785
push userdougt@mozilla.com
push dateTue, 21 Apr 2015 18:11:20 +0000
treeherdermozilla-inbound@a5eee04c796e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1156052
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1156052 - Add push information to about:serviceworkers. r=baku
toolkit/content/aboutServiceWorkers.js
toolkit/locales/en-US/chrome/global/aboutServiceWorkers.properties
--- a/toolkit/content/aboutServiceWorkers.js
+++ b/toolkit/content/aboutServiceWorkers.js
@@ -4,16 +4,23 @@
 
 'use strict';
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
 
+XPCOMUtils.defineLazyServiceGetter(
+  this,
+  "PushNotificationService",
+  "@mozilla.org/push/NotificationService;1",
+  "nsIPushNotificationService"
+);
+
 const bundle = Services.strings.createBundle(
   "chrome://global/locale/aboutServiceWorkers.properties");
 
 let gSWM;
 let gSWCount = 0;
 
 function init() {
   let enabled = Services.prefs.getBoolPref("dom.serviceWorkers.enabled");
@@ -96,16 +103,25 @@ function display(info) {
   }
 
   createItem(bundle.GetStringFromName('scope'), info.scope);
   createItem(bundle.GetStringFromName('scriptSpec'), info.scriptSpec, true);
   createItem(bundle.GetStringFromName('currentWorkerURL'), info.currentWorkerURL, true);
   createItem(bundle.GetStringFromName('activeCacheName'), info.activeCacheName);
   createItem(bundle.GetStringFromName('waitingCacheName'), info.waitingCacheName);
 
+  PushNotificationService.registration(info.scope).then(
+    pushRecord => {
+      createItem(bundle.GetStringFromName('pushEndpoint'), JSON.stringify(pushRecord));
+    },
+    error => {
+      dump("about:serviceworkers - push registration failed\n");
+    }
+  );
+
   let updateButton = document.createElement("button");
   updateButton.appendChild(document.createTextNode(bundle.GetStringFromName('update')));
   updateButton.onclick = function() {
     gSWM.update(info.scope);
   };
   div.appendChild(updateButton);
 
   let unregisterButton = document.createElement("button");
--- a/toolkit/locales/en-US/chrome/global/aboutServiceWorkers.properties
+++ b/toolkit/locales/en-US/chrome/global/aboutServiceWorkers.properties
@@ -26,8 +26,10 @@ false = false
 update = Update
 
 unregister = Unregister
 
 waiting = Waiting…
 
 # LOCALIZATION NODE the term "Service Worker" should not translated.
 unregisterError = Failed to unregister this Service Worker.
+
+pushEndpoint = Push Endpoint:
\ No newline at end of file