Bug 1079748 - Implement hierarchy manager

wouldn't mind doing an aync test with a `window.addEventListener...done()` for those 2 tests, but I can live without :)