Author: johnh
Date: Mon Sep 14 02:30:29 2009
New Revision: 814464
URL: http://svn.apache.org/viewvc?rev=814464&view=rev
Log:
Store the initial value of window.name in gadgets.rpc for continued use in
gadgets.rpc calls, to prevent window.name symbol shadowing by "var name" and
similar in gadget code.
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/rpc/rmr.transport.js
incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.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=814464&r1=814463&r2=814464&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
Mon Sep 14 02:30:29 2009
@@ -193,7 +193,7 @@
try {
if (frameId === '..') {
// We are a gadget.
- channelWindow = window.parent.frames['rmrtransport-' + window.name];
+ channelWindow = window.parent.frames['rmrtransport-' +
gadgets.rpc.RPC_ID];
} else {
// We are a container.
channelWindow = window.frames[frameId].frames['rmrtransport-..'];
@@ -373,7 +373,7 @@
// messages to be sent.
if (nonAckReceived ||
(noLongerWaiting && channel.queue.length > 0)) {
- var from = (fromFrameId === '..') ? window.name : '..';
+ var from = (fromFrameId === '..') ? gadgets.rpc.RPC_ID : '..';
callRmr(fromFrameId, gadgets.rpc.ACK, from, {ackAlone: nonAckReceived});
}
}
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js?rev=814464&r1=814463&r2=814464&view=diff
==============================================================================
--- incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
(original)
+++ incubator/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
Mon Sep 14 02:30:29 2009
@@ -86,6 +86,10 @@
// isGadget =~ isChild for the purposes of rpc (used only in setup).
var isGadget = (window.top !== window.self);
+ // Set the current rpc ID from window.name immediately, to prevent
+ // shadowing of window.name by a "var name" declaration, or similar.
+ var rpcId = window.name;
+
// Fallback transport is simply a dummy impl that emits no errors
// and logs info on calls it receives, to avoid undesired side-effects
// from falling back to IFPC or some other transport.
@@ -538,7 +542,7 @@
var from = '..';
if (targetId === '..') {
- from = window.name;
+ from = rpcId;
}
++callId;
@@ -704,7 +708,9 @@
},
/** Exported constant, for use by transports only. */
- ACK: ACK
+ ACK: ACK,
+
+ RPC_ID: rpcId
};
}();