code: function _wrapMessageHandler(onmessage) {
              return function(message) {
                  var msgObject;
  
                  if (!message.origin || "*" === message.origin ||  this.targetOrigin === message.origin) {
                      if (_isHandshake.call(this, message) && !this.disposed && !this.hosted && !this.ready) {
                          _onReady.call(this);
                      }
                      else {
                          try {
                              msgObject = this.deserialize(message.data);
  
                              if (_validateToken.call(this, msgObject)) {
                                  return onmessage && onmessage(msgObject);
                              }
                          }
                          catch (ex) {
                              msgObject = message.data || message;
                              PostMessageUtilities.log("Error while trying to handle the message", "ERROR", "PostMessageChannel");
                          }
  
                          return msgObject || message;
                      }
                  }
              };
          }
docs: Method for wrapping the handler of the postmessage for parsing
  @param {Function} onmessage - the handler for incoming messages to invoke
  @returns {Function} handler function for messages
  @private