Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1108

IE8 issues with wpm RPC mechanism

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1-BETA1
    • Fix Version/s: 1.1-BETA1
    • Component/s: Javascript
    • Labels:
      None
    • Environment:
      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);+ }

        ;
        +
        + // Set up native postMessage handler.
        + if (typeof window.addEventListener != 'undefined')

        { + window.addEventListener('message', onmessage, false); + }

        else if (typeof window.attachEvent != 'undefined')

        { + window.attachEvent('onmessage', onmessage); + }

        ready('..', true); // Immediately ready to send to parent.
        return true;
        },

        Attachments

          Activity

            People

            • Assignee:
              plindner Paul Lindner
              Reporter:
              plindner Paul Lindner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: