Using the username and password fields of xhr will sometimes cause messages like "no element found: http://username:pass@host/path/..." to show up in the error console. Not very nice to see.
Setting the Authorization header seems to work well, and there should also be an option to not pass anything and have browser/app prompt for the password, as far as that is possible. This might also allow for digest authentication easily.