Author: johnh
Date: Wed Mar 2 21:45:13 2011
New Revision: 1076405
URL: http://svn.apache.org/viewvc?rev=1076405&view=rev
Log:
verified-origin version of flash transport
Modified:
shindig/trunk/content/xpc.swf
shindig/trunk/features/src/main/flex/Main.as
shindig/trunk/features/src/main/javascript/features/rpc/flash.transport.js
Modified: shindig/trunk/content/xpc.swf
URL:
http://svn.apache.org/viewvc/shindig/trunk/content/xpc.swf?rev=1076405&r1=1076404&r2=1076405&view=diff
==============================================================================
Files shindig/trunk/content/xpc.swf (original) and
shindig/trunk/content/xpc.swf Wed Mar 2 21:45:13 2011 differ
Modified: shindig/trunk/features/src/main/flex/Main.as
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/flex/Main.as?rev=1076405&r1=1076404&r2=1076405&view=diff
==============================================================================
--- shindig/trunk/features/src/main/flex/Main.as (original)
+++ shindig/trunk/features/src/main/flex/Main.as Wed Mar 2 21:45:13 2011
@@ -30,7 +30,7 @@ class Main {
SINGLETON = true;
var my_origin:String;
-
+
if (_level0.origin == undefined){
my_origin = "http://*";
} else {
@@ -67,7 +67,6 @@ class Main {
var receiving_lc:LocalConnection = new LocalConnection();
var sending_lc:LocalConnection = new LocalConnection();
receiving_lc.receiveMessage = function(to_origin:String,
from_origin:String, from_id:String, message:String) {
- //ExternalInterface.call("alert", "receiving_lc.receiveMessage(),
to_origin=" + to_origin + ", from_origin=" + from_origin + ", from_id=" +
from_id + ", my_origin=" + my_origin + ", target_id=" + target_id + ",
channel_recv_id=" + channel_recv_id + ", check1=" + (to_origin===my_origin) +
", check2.1=" + (from_id === target_id) + ", check2.2=" + (from_id === "_top")
+ ", check2.3=" + (target_id === ".."));
if ((to_origin === "*" || to_origin === my_origin) && ((from_id ===
target_id) || (from_id === "_top" && target_id === ".."))) {
ExternalInterface.call("gadgets.rpctx.flash._receiveMessage",
from_id, message, from_origin, to_origin);
}
@@ -75,10 +74,9 @@ class Main {
ExternalInterface.addCallback("sendMessage_" + target_id, { },
function(message:String, to_origin:String) {
if (!to_origin) to_origin = "*";
- //ExternalInterface.call("alert", "attempting to send message: " +
message + " to=" + to_origin + ", channel=" + channel_recv_id + "_" +
other_role + ", target_id=" + target_id);
- sending_lc.send(channel_recv_id + "_" + other_role, "receiveMessage",
to_origin, my_origin, my_id, message);
+ sending_lc.send("channel_" + channel_recv_id + "_" + other_role,
"receiveMessage", to_origin, my_origin, my_id, message);
});
- receiving_lc.connect(channel_recv_id + "_" + role);
+ receiving_lc.connect("channel_" + channel_recv_id + "_" + role);
});
ExternalInterface.call("gadgets.rpctx.flash._ready");
}
Modified:
shindig/trunk/features/src/main/javascript/features/rpc/flash.transport.js
URL:
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/flash.transport.js?rev=1076405&r1=1076404&r2=1076405&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/rpc/flash.transport.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/rpc/flash.transport.js
Wed Mar 2 21:45:13 2011
@@ -125,8 +125,8 @@ if (!gadgets.rpctx.flash) { // make lib
// Methods called by relay SWF. Should be considered private.
_receiveMessage: function(fromId, message, fromOrigin, toOrigin) {
- // TODO: validate fromId for sanity, and fromOrigin/toOrigin for
domain verification.
- window.setTimeout(function() { process(gadgets.json.parse(message));
}, 0);
+ if (fromId !== this['f']) { /* TODO: anything? */ }
+ window.setTimeout(function() { process(gadgets.json.parse(message,
fromOrigin)); }, 0);
},
_ready: function() {