Re-land pull request #19770 from tauzen/Bug1017572 since it wasn't at fault for Gaia unit test failures.

This reverts commit 4152286b9cbadaa8fe2fecfa82226e99ae41a679.