You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by rb...@apache.org on 2011/08/23 18:43:57 UTC
svn commit: r1160787 -
/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
Author: rbaxter85
Date: Tue Aug 23 16:43:57 2011
New Revision: 1160787
URL: http://svn.apache.org/viewvc?rev=1160787&view=rev
Log:
SHINDIG-1565
Fixes bug where same domain RPC requests were failing due to change to how we were generating site ids.
Modified:
shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
Modified: shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js?rev=1160787&r1=1160786&r2=1160787&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/rpc/rpc.js (original)
+++ shindig/trunk/features/src/main/javascript/features/rpc/rpc.js Tue Aug 23 16:43:57 2011
@@ -438,19 +438,19 @@ if (!window['gadgets']['rpc']) { // make
// Cast to a String to avoid an index lookup.
id = String(id);
-
- // Try window.frames first
- var target = window.frames[id];
- if (target) {
- return target;
- }
-
- // Fall back to getElementById()
+
+ // Try getElementById() first
target = document.getElementById(id);
if (target && target.contentWindow) {
return target.contentWindow;
}
+ // Fallback to window.frames
+ var target = window.frames[id];
+ if (target && !target.closed) {
+ return target;
+ }
+
return null;
}
@@ -539,7 +539,9 @@ if (!window['gadgets']['rpc']) { // make
* @return {boolean}
*/
function callSameDomain(target, rpc) {
- if (typeof sameDomain[target] === 'undefined') {
+ var targetEl = getTargetWin(target);
+ if (typeof sameDomain[target] === 'undefined' ||
+ targetEl.Function.prototype !== sameDomain[target].constructor.prototype) {
// Seed with a negative, typed value to avoid
// hitting this code path repeatedly.
sameDomain[target] = false;
@@ -549,7 +551,6 @@ if (!window['gadgets']['rpc']) { // make
return false;
}
- var targetEl = getTargetWin(target);
try {
// If this succeeds, then same-domain policy applied
var targetGadgets = targetEl['gadgets'];