Bug 900605 - Clean up code duplication introduced by bug 900545. r=armenzg