lib: Fix service.js for privilege changes
lib: Fix service.js for privilege changes

`systemd_client` gets cached forever, and thus never reacts to privilege
changes (adding/dropping sudo channel). We also can't just reinitialize
this, as this would break existing proxies.

Instead, keep the long-lived proxy as unprivileged, and only use it for
watching/reading. Use a fresh cockpit.dbus() instance with `superuser`
for all the actions instead -- cockpit.dbus() is cheap, and actions are
done rarely.

This requires reworking the `JobRemoved` handler: doing this on the
persistent unprivileged proxy sometimes misses events from the separate
D-Bus connections, so this must happen on the same connection that
started the job. Move the listener into call_manager_with_job() as an
one-off, and get rid of the persistent `pending_jobs` house-keeping.

Some pages/tests (at least TestHistoryMetrics.testPmProxySettings) rely
on the proxy properties (enabled/active) being current after some action
like .start() or .enable() returns. A single cockpit.dbus() guaranteed
the correct signal/event processing order; to retain that behaviour with
multiple connecions, explicitly call refresh() after actions, make that
return a promise, and wait for that.

martinpitt/cockpit,cockpit-project/cockpit,cockpit-project/cockpit,martinpitt/cockpit,cockpit-project/cockpit,martinpitt/cockpit,cockpit-project/cockpit,mvollmer/cockpit,mvollmer/cockpit,mvollmer/cockpit,mvollmer/cockpit,mvollmer/cockpit,cockpit-project/cockpit,martinpitt/cockpit,martinpitt/cockpit