Author: johnh
Date: Tue Aug 18 02:57:38 2009
New Revision: 805264

URL: http://svn.apache.org/viewvc?rev=805264&view=rev
Log:
Minor window.postMessage(...) transport improvements.

* Rename "relay" to "origin", since that's how the parameter is being used.
* Improve error message.
* Canonicalize targetOrigin to accommodate relative URLs.


Modified:
    
incubator/shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js

Modified: 
incubator/shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js?rev=805264&r1=805263&r2=805264&view=diff
==============================================================================
--- 
incubator/shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js
 (original)
+++ 
incubator/shindig/trunk/features/src/main/javascript/features/rpc/wpm.transport.js
 Tue Aug 18 02:57:38 2009
@@ -82,11 +82,13 @@
 
     call: function(targetId, from, rpc) {
       var targetWin = targetId === '..' ? window.parent : 
window.frames[targetId];
-      var relay = gadgets.rpc.getRelayUrl(targetId);
-      if (relay) {
-        targetWin.postMessage(gadgets.json.stringify(rpc), relay);
+      // targetOrigin = canonicalized relay URL
+      var origin = gadgets.rpc.getOrigin(gadgets.rpc.getRelayUrl(targetId));
+      if (origin) {
+        targetWin.postMessage(gadgets.json.stringify(rpc), origin);
       } else {
-        gadgets.error("No relay set, cannot send cross-domain message");
+        gadgets.error("No relay set (used as window.postMessage targetOrigin)" 
+
+            + ", cannot send cross-domain message");
       }
       return true;
     }


Reply via email to