Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.1-BETA1
-
None
-
IE8 build 6001
Description
Testing the latest rpc code we found that IE8 was having big problems. Specifically:
window.postMessage is an object, not a function and
window.attachEvent needs to be used instead of window.addEventListener
A simple patch is as follows:
===================================================================
— features/src/main/javascript/features/rpc/rpc.js (revision 790359)
+++ features/src/main/javascript/features/rpc/rpc.js (working copy)
@@ -119,6 +119,7 @@
*/
function getTransport() {
return typeof window.postMessage === 'function' ? gadgets.rpctx.wpm :
+ typeof window.postMessage === 'object' ? gadgets.rpctx.wpm :
window.ActiveXObject ? gadgets.rpctx.nix :
navigator.userAgent.indexOf('WebKit') > 0 ? gadgets.rpctx.rmr :
navigator.product === 'Gecko' ? gadgets.rpctx.frameElement :
Index: features/src/main/javascript/features/rpc/wpm.transport.js
===================================================================
— features/src/main/javascript/features/rpc/wpm.transport.js (revision 790359)
+++ features/src/main/javascript/features/rpc/wpm.transport.js (working copy)
@@ -56,11 +56,17 @@
init: function(processFn, readyFn) {
ready = readyFn;
- // Set up native postMessage handler.
- window.addEventListener('message', function(packet)
Unknown macro: {+ var onmessage = function(packet) { // TODO validate packet.domain for security reasons processFn(gadgets.json.parse(packet.data)); - }, false);+ }
;
{ + window.addEventListener('message', onmessage, false); + }
+
+ // Set up native postMessage handler.
+ if (typeof window.addEventListener != 'undefined')else if (typeof window.attachEvent != 'undefined')
{ + window.attachEvent('onmessage', onmessage); + }ready('..', true); // Immediately ready to send to parent.
return true;
},