You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by jo...@apache.org on 2009/07/30 21:25:53 UTC

svn commit: r799421 - /incubator/shindig/trunk/features/src/main/javascript/features/rpc/rmr.transport.js

Author: johnh
Date: Thu Jul 30 19:25:53 2009
New Revision: 799421

URL: http://svn.apache.org/viewvc?rev=799421&view=rev
Log:
Small updates to RMR enabling it to work on other browsers (eg. for use in parent verifiability in the future):
  * wrap channelWindow assignment to ensure no permissions exceptions prevent RMR setup
  * attach onresize handler through attachEvent if present, enabling RMR to work on IE (if the relay exists; 404s will still not work)

Thanks to Zhen Huang for the research and code.


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

Modified: incubator/shindig/trunk/features/src/main/javascript/features/rpc/rmr.transport.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/rpc/rmr.transport.js?rev=799421&r1=799420&r2=799421&view=diff
==============================================================================
--- incubator/shindig/trunk/features/src/main/javascript/features/rpc/rmr.transport.js (original)
+++ incubator/shindig/trunk/features/src/main/javascript/features/rpc/rmr.transport.js Thu Jul 30 19:25:53 2009
@@ -179,12 +179,18 @@
     // Increment the search counter.
     rmr_channels[frameId].searchCounter++;
 
-    if (frameId === '..') {
-      // We are a gadget.
-      channelWindow = window.parent.frames['rmrtransport-' + window.name];
-    } else {
-      // We are a container.
-      channelWindow = window.frames[frameId].frames['rmrtransport-..'];
+    try {
+      if (frameId === '..') {
+        // We are a gadget.
+        channelWindow = window.parent.frames['rmrtransport-' + window.name];
+      } else {
+        // We are a container.
+        channelWindow = window.frames[frameId].frames['rmrtransport-..'];
+      }
+    } catch (e) {
+      // Just in case; may happen when relay is set to about:blank or unset.
+      // Catching exceptions here ensures that the timeout to continue the
+      // search below continues to work.
     }
 
     var status = false;
@@ -425,10 +431,16 @@
     channel.receiveWindow = channelWindow;
 
     // Register the onresize handler.
-    channelWindow.onresize = function() {
+    function onresize() {
       processRmrData(frameId);
     };
 
+    if (typeof channelWindow.attachEvent === "undefined") {
+      channelWindow.onresize = onresize;
+    } else {
+      channelWindow.attachEvent("onresize", onresize);
+    }
+
     if (frameId === '..') {
       // Gadget to container. Signal to the container that the gadget
       // is ready to receive messages by attaching the g -> c relay.