Bug 853782 - 0002. Notify receiving of WAP Push by System Message. r=vicamo
authorChuck Lee <chulee@mozilla.com>
Mon, 17 Jun 2013 16:37:59 +0800
changeset 146910 5026554ec28fe81b40f0b1e29776da00de425cbd
parent 146909 183501e0a90506e72ab4b3c368f5202af162fb48
child 146911 68ce74382b35551d01b835d39272f2dfe21be3c0
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs853782
milestone24.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 853782 - 0002. Notify receiving of WAP Push by System Message. r=vicamo
dom/messages/SystemMessagePermissionsChecker.jsm
dom/wappush/src/gonk/WapPushManager.js
--- a/dom/messages/SystemMessagePermissionsChecker.jsm
+++ b/dom/messages/SystemMessagePermissionsChecker.jsm
@@ -92,17 +92,20 @@ this.SystemMessagePermissionsTable = {
   "telephony-new-call": {
     "telephony": []
   },
   "telephony-call-ended": {
     "telephony": []
   },
   "ussd-received": {
     "mobileconnection": []
-  }
+  },
+  "wappush-received": {
+    "sms": []
+  },
 };
 
 this.SystemMessagePermissionsChecker = {
   /**
    * Return all the needed permission names for the given system message.
    * @param string aSysMsgName
    *        The system messsage name.
    * @returns object
--- a/dom/wappush/src/gonk/WapPushManager.js
+++ b/dom/wappush/src/gonk/WapPushManager.js
@@ -23,16 +23,20 @@ XPCOMUtils.defineLazyGetter(this, "SI", 
 });
 
 XPCOMUtils.defineLazyGetter(this, "SL", function () {
   let SL = {};
   Cu.import("resource://gre/modules/SlPduHelper.jsm", SL);
   return SL;
 });
 
+XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
+                                   "@mozilla.org/system-message-internal;1",
+                                   "nsISystemMessagesInternal");
+
 /**
  * Helpers for WAP PDU processing.
  */
 this.WapPushManager = {
 
   /**
    * Parse raw PDU data and deliver to a proper target.
    *
@@ -93,17 +97,20 @@ this.WapPushManager = {
 
       // Unsupported type, provide raw data.
       msg = {
         contentType: contentType,
         content: data.array
       };
     }
 
-    // TODO: Bug 853782 - Notify receiving of WAP Push messages
+    gSystemMessenger.broadcastMessage("wappush-received", {
+      contentType:    msg.contentType,
+      content:        msg.content
+    });
   },
 
   /**
    * @param array
    *        A Uint8Array or an octet array representing raw PDU data.
    * @param length
    *        Length of the array.
    * @param offset