Bug 869291 - 0003. Handle CP message. r=vicamo
authorChuck Lee <chulee@mozilla.com>
Wed, 03 Jul 2013 11:30:17 +0800
changeset 152268 1e4285701fac58019772a78c765f0ae81737cda5
parent 152267 f31f09459b3f31e1d7293d44e1df8e5f6d7ad859
child 152269 e8ee9efc1d3b25d6f966eef79504e6719a5b836d
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs869291
milestone25.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 869291 - 0003. Handle CP message. r=vicamo
dom/wappush/src/gonk/WapPushManager.js
--- a/dom/wappush/src/gonk/WapPushManager.js
+++ b/dom/wappush/src/gonk/WapPushManager.js
@@ -23,16 +23,22 @@ XPCOMUtils.defineLazyGetter(this, "SI", 
 });
 
 XPCOMUtils.defineLazyGetter(this, "SL", function () {
   let SL = {};
   Cu.import("resource://gre/modules/SlPduHelper.jsm", SL);
   return SL;
 });
 
+XPCOMUtils.defineLazyGetter(this, "CP", function () {
+  let CP = {};
+  Cu.import("resource://gre/modules/CpPduHelper.jsm", CP);
+  return CP;
+});
+
 XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
                                    "@mozilla.org/system-message-internal;1",
                                    "nsISystemMessagesInternal");
 
 /**
  * Helpers for WAP PDU processing.
  */
 this.WapPushManager = {
@@ -87,19 +93,20 @@ this.WapPushManager = {
     let msg;
 
     if (contentType === "text/vnd.wap.si" ||
         contentType === "application/vnd.wap.sic") {
       msg = SI.PduHelper.parse(data, contentType);
     } else if (contentType === "text/vnd.wap.sl" ||
                contentType === "application/vnd.wap.slc") {
       msg = SL.PduHelper.parse(data, contentType);
+    } else if (contentType === "text/vnd.wap.connectivity-xml" ||
+               contentType === "application/vnd.wap.connectivity-wbxml") {
+      msg = CP.PduHelper.parse(data, contentType);
     } else {
-      // TODO: Bug 869291 - Support Receiving WAP-Push-CP
-
       // Unsupported type, provide raw data.
       msg = {
         contentType: contentType,
         content: data.array
       };
     }
 
     gSystemMessenger.broadcastMessage("wappush-received", {