port domain util from chromium project