base: Provide cockpit.transport.origin property

This is the same as window.location.origin, but we cannot rely
on the latter, since it is not supported by Internet Explorer,
even version 10.

Add documentation and tests.
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Implement transport.filter() and transport.inject()

These methods allow one to filter incoming messages and inject
outgoing messages. Needed when forwarding WebSocket via another
web frame.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Cleaner channel-seed suffix

channel-seed should generally be used as a prefix. So add a
separator in to the mix from the very start.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Expose the transport options from the "init" message

This is similar to exposing channel.options. Necessary for forwarding
WebSocket to another iframe.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Channels to the right host provided by the init message

The default-host is now carried by the init message. We use this
to determine the default "host" field in channels.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
base: Send cockpit protocol via parent frame where possible

Instead of each frame opening up their own websocket, send
messages via the parent frame if possible.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
shell: Don't add our own properties to a frame window.

They get removed when the frame content loads.
shell: Register child windows directly.

Instead of finding them again by name.  This is more direct and it
becomes a internal detail of register_child that it associates peer
information with windows via the name.  (Ideally we would use the
Window object itself as the key in a hashtable...)
shell: Use explicit fallback when transport options are not set yet.

This will cease to happen once the shell looks up the packages before
loading external pages.
base: Don't delay opening of a ParentWebSocket.

Instead, do it immediately when returning to the event loop.
base, shell: Be more careful when forwarding control messages.

The "init" command is never forwarded, and non-broadcast messages in
the control channel are only forwarded to their corresponding peer.

Closes #1400.