Make environment changes algorithm use pending request machinery. Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=25890 https://www.w3.org/Bugs/Public/show_bug.cgi?id=25889