Author: lindner
Date: Wed Apr 28 18:38:56 2010
New Revision: 939047
URL: http://svn.apache.org/viewvc?rev=939047&view=rev
Log:
SHINDIG-1318 | Patch from Tim Wintle | IE8 rpc for 1.0.x
Modified:
shindig/branches/1.0.x-incubating/features/src/main/javascript/features/rpc/rpc.js
Modified:
shindig/branches/1.0.x-incubating/features/src/main/javascript/features/rpc/rpc.js
URL:
http://svn.apache.org/viewvc/shindig/branches/1.0.x-incubating/features/src/main/javascript/features/rpc/rpc.js?rev=939047&r1=939046&r2=939047&view=diff
==============================================================================
---
shindig/branches/1.0.x-incubating/features/src/main/javascript/features/rpc/rpc.js
(original)
+++
shindig/branches/1.0.x-incubating/features/src/main/javascript/features/rpc/rpc.js
Wed Apr 28 18:38:56 2010
@@ -177,6 +177,7 @@ gadgets.rpc = function() {
*/
function getRelayChannel() {
return typeof window.postMessage === 'function' ? 'wpm' :
+ typeof window.postMessage === 'object' ? 'wpm':
typeof document.postMessage === 'function' ? 'dpm' :
window.ActiveXObject ? 'nix' :
navigator.product === 'Gecko' ? 'fe' :
@@ -192,10 +193,17 @@ gadgets.rpc = function() {
// postMessage based ones, setup the handler to receive
// messages.
if (relayChannel === 'dpm' || relayChannel === 'wpm') {
- window.addEventListener('message', function(packet) {
+ var onmessage = function (packet) {
// TODO validate packet.domain for security reasons
process(gadgets.json.parse(packet.data));
- }, false);
+ }
+
+ if (typeof window.addEventListener != 'undefined') {
+ window.addEventListener('message', onmessage, false);
+ } else if (typeof window.attachEvent != 'undefined') {
+ window.attachEvent('onmessage', onmessage);
+ }
+
}
// If the channel type is NIX, we need to ensure the