Fixed regression in api-utils, added `register`/`unregister` to state, new unit test for private windows