Implement shouldReplaceHost in js api