(url)
| 35 | * @return {String} The URLs origin |
| 36 | */ |
| 37 | export const resolveOrigin = (url) => { |
| 38 | const a = document.createElement('a') |
| 39 | a.href = url |
| 40 | const protocol = a.protocol.length > 4 ? a.protocol : window.location.protocol |
| 41 | const host = a.host.length ? ((a.port === '80' || a.port === '443') ? a.hostname : a.host) : window.location.host |
| 42 | return a.origin || `${protocol}//${host}` |
| 43 | } |
| 44 | |
| 45 | const messageTypes = { |
| 46 | handshake: 1, |
no outgoing calls
no test coverage detected