Bug 1383814: throw exception for too long TURN username. r?mjf
MozReview-Commit-ID: 2K9lU5Ycbny
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -637,16 +637,21 @@ class RTCPeerConnection {
throw new this._win.DOMException(msg + " - missing urls", "InvalidAccessError");
}
urls.map(url => nicerNewURI(url)).forEach(({ scheme, spec }) => {
if (scheme in { turn: 1, turns: 1 }) {
if (username == undefined) {
throw new this._win.DOMException(msg + " - missing username: " + spec,
"InvalidAccessError");
}
+ if (username.length > 512) {
+ throw new this._win.DOMException(msg +
+ " - username longer then 512 bytes: "
+ + username, "InvalidAccessError");
+ }
if (credential == undefined) {
throw new this._win.DOMException(msg + " - missing credential: " + spec,
"InvalidAccessError");
}
if (credentialType != "password") {
this.logWarning("RTCConfiguration TURN credentialType \"" +
credentialType +
"\" is not yet implemented. Treating as password." +