Bug 1339681 - PushServiceAndroidGCM: Send strings instead of json in event callbacks. r=Grisha

MozReview-Commit-ID: 29BEjnh1TpT

--HG--
extra : rebase_source : 91c36139fdb614b30900aeb36456981fe2961162
This commit is contained in:
Edouard Oger 2017-02-15 18:47:30 +01:00
parent 11a122fac4
commit 44146ebe96
2 changed files with 4 additions and 2 deletions

View File

@ -182,6 +182,7 @@ this.PushServiceAndroidGCM = {
type: "PushServiceAndroidGCM:DumpSubscriptions",
})
.then(subscriptions => {
subscriptions = JSON.parse(subscriptions);
console.debug("connect:", subscriptions);
// subscriptions maps chid => subscription data.
return Promise.all(records.map(record => {
@ -225,6 +226,7 @@ this.PushServiceAndroidGCM = {
// Caller handles errors.
return EventDispatcher.instance.sendRequestForResult(message)
.then(data => {
data = JSON.parse(data);
console.debug("Got data:", data);
return PushCrypto.generateKeys()
.then(exportedKeys =>

View File

@ -310,7 +310,7 @@ public class PushService implements BundleEventListener {
for (Map.Entry<String, PushSubscription> entry : result.entrySet()) {
json.put(entry.getKey(), entry.getValue().toJSONObject());
}
callback.sendSuccess(json);
callback.sendSuccess(json.toString());
} catch (JSONException e) {
callback.sendError("Got exception handling message [" + event + "]: " + e.toString());
}
@ -370,7 +370,7 @@ public class PushService implements BundleEventListener {
}
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SERVICE, "dom-push-api");
callback.sendSuccess(json);
callback.sendSuccess(json.toString());
return;
}
if ("PushServiceAndroidGCM:UnsubscribeChannel".equals(event)) {