Fixes #4131

A slight refactor.
auto merge of #4132 : jtuchsen/servo/issue-4131, r=jdm

A slight refactor.