You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by jo...@apache.org on 2009/02/19 04:19:08 UTC

svn commit: r745717 - /incubator/shindig/trunk/features/rpc/rpc.js

Author: johnh
Date: Thu Feb 19 03:19:07 2009
New Revision: 745717

URL: http://svn.apache.org/viewvc?rev=745717&view=rev
Log:
Ignore window.postMessage(...) calls that are doomed to fail on account of a targetOrigin parameter provided that doesn't contain scheme/host/port. This allows gadgets to render on FF3 in contexts where gadgets.rpc isn't supported, rather than simply breaking them outright.


Modified:
    incubator/shindig/trunk/features/rpc/rpc.js

Modified: incubator/shindig/trunk/features/rpc/rpc.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/rpc/rpc.js?rev=745717&r1=745716&r2=745717&view=diff
==============================================================================
--- incubator/shindig/trunk/features/rpc/rpc.js (original)
+++ incubator/shindig/trunk/features/rpc/rpc.js Thu Feb 19 03:19:07 2009
@@ -696,7 +696,12 @@
             break;
           }
         }
-        relayUrl['..'] = parentParam + config.rpc.parentRelayUrl;
+        if (parentParam !== "") {
+          // Otherwise, relayUrl['..'] will be null, signaling transport
+          // code to ignore rpc calls since they cannot work without a
+          // relay URL with host qualification.
+          relayUrl['..'] = parentParam + config.rpc.parentRelayUrl;
+        }
       }
       useLegacyProtocol['..'] = !!config.rpc.useLegacyProtocol;
     }
@@ -826,7 +831,10 @@
 
         case 'wpm': // use window.postMessage.
           var targetWin = targetId === '..' ? parent : frames[targetId];
-          targetWin.postMessage(rpcData, relayUrl[targetId]);
+          var relay = gadgets.rpc.getRelayUrl(targetId);
+          if (relay) {
+            targetWin.postMessage(rpcData, relay);
+          }
           break;
 
         case 'nix': // use NIX.