packages/ui-react-utils/src/windowMessageListener.js
function origin (node) {
  const ownWindow = ownerWindow(node)

  const { location } = ownWindow


  if (location.protocol === 'file:') {
    return '*'
  } else if (location.origin) {
    return location.origin
  } else if (location.port) {
    return `${location.protocol}//${location.hostname}:${location.port}`
  } else {
    return `${location.protocol}//${location.hostname}`
  }
}
function origin (node) {
  const ownWindow = ownerWindow(node)

  const { location } = ownWindow


  if (location.protocol === 'file:') {
    return '*'
  } else if (location.origin) {
    return location.origin
  } else if (location.port) {
    return `${location.protocol}//${location.hostname}:${location.port}`
  } else {
    return `${location.protocol}//${location.hostname}`
  }
}
function origin ( node ) { const ownWindow = ownerWindow ( node ) const { location } = ownWindow if ( location . protocol === 'file:' ) { return '*' } else if ( location . origin ) { return location . origin } else if ( location . port ) { return ` ${ location . protocol } ${ location . hostname } ${ location . port } ` } else { return ` ${ location . protocol } ${ location . hostname } ` } }
Return the origin of the owner window of the DOM element

see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

@param {DOMElement} node
@returns {String} the origin
Return the origin of the owner window of the DOM element