Commit 04733133 authored by Sven Franck's avatar Sven Franck

fix no type in postMessage can pass renderjs

parent cf8b64e5
...@@ -54,6 +54,9 @@ ...@@ -54,6 +54,9 @@
// http://bit.ly/WH2TRI // http://bit.ly/WH2TRI
// http://bit.ly/zm0Csi // http://bit.ly/zm0Csi
// URI-templates:
// https://code.google.com/p/uri-templates/
/*jslint indent: 2, maxlen: 80, nomen: true */ /*jslint indent: 2, maxlen: 80, nomen: true */
/*global window: true, $: true, undefined: true, console: true, /*global window: true, $: true, undefined: true, console: true,
document: true, require: true*/ document: true, require: true*/
...@@ -517,40 +520,42 @@ ...@@ -517,40 +520,42 @@
// => manages all interactions (listens to incoming postMessages) // => manages all interactions (listens to incoming postMessages)
// need a switch, because only one "message" listener can be set // need a switch, because only one "message" listener can be set
priv.serviceHandler = function (event) { priv.serviceHandler = function (event) {
var route = event.data.type.split("/"), var type = event.data.type, route, trackingId;
trackingId; if (type) {
route = event.data.type.split("/");
// authenticate all message senders
// basic "authentication" is done through the switch, which requires // authenticate all message senders
// a matching type to be passed - still the incoming URL should be // basic "authentication" is done through the switch, which requires
// authenticated, too, plus preferably another ticket-authentication. // a matching type to be passed - still the incoming URL should be
// authenticated, too, plus preferably another ticket-authentication.
// route
switch (route[0]) { // route
case "service": switch (route[0]) {
priv.registerNewService(event); case "service":
break; priv.registerNewService(event);
case "request": break;
trackingId = priv.generateUuid(); case "request":
// track this request, so we know where to send the response trackingId = priv.generateUuid();
priv.trackRequest(trackingId, event.originalTarget); // track this request, so we know where to send the response
// request the service priv.trackRequest(trackingId, event.originalTarget);
priv.requestServiceFromGadget(event, trackingId); // request the service
break; priv.requestServiceFromGadget(event, trackingId);
case "tree": break;
if (route[1] === "update") { case "tree":
priv.addGadgetToTree(event.data.options, that.gadgetTree); if (route[1] === "update") {
priv.addGadgetToTree(event.data.options, that.gadgetTree);
}
break;
case "run":
priv.runService(event);
break;
case "result":
priv.sendServiceReply(event);
break;
case "reply":
priv.returnResult(event);
break;
} }
break;
case "run":
priv.runService(event);
break;
case "result":
priv.sendServiceReply(event);
break;
case "reply":
priv.returnResult(event);
break;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment