Issue 7506: Improve performance of switching between Javascript sources.