port registry_controlled_domain from chromium, left some test cases to be fixed