Changeset 164602 in webkit


Ignore:
Timestamp:
Feb 24, 2014 1:00:36 PM (10 years ago)
Author:
thiago.lacerda@openbossa.org
Message:

[WebRTC] Validating RTCConfiguration according to the spec
https://bugs.webkit.org/show_bug.cgi?id=129182

Reviewed by Eric Carlson.

Spec states that:

  • iceServers should not be an empty list
  • the entry in the configuration dictionary is "urls", instead of "url"
  • urls can be either a list or a string

Fixing all that in RTCConfiguration validation when creating a RTCPeerConnection

Source/WebCore:

Existing tests were updated.

  • Modules/mediastream/RTCPeerConnection.cpp:

(WebCore::appendIceServer): Added.
(WebCore::processIceServer): Added.
(WebCore::RTCPeerConnection::parseConfiguration):

LayoutTests:

  • fast/mediastream/RTCPeerConnection-AddRemoveStream.html:
  • fast/mediastream/RTCPeerConnection-createAnswer.html:
  • fast/mediastream/RTCPeerConnection-createOffer.html:
  • fast/mediastream/RTCPeerConnection-datachannel.html:
  • fast/mediastream/RTCPeerConnection-dtmf.html:
  • fast/mediastream/RTCPeerConnection-events.html:
  • fast/mediastream/RTCPeerConnection-expected.txt:
  • fast/mediastream/RTCPeerConnection-have-local-answer.html:
  • fast/mediastream/RTCPeerConnection-have-local-offer.html:
  • fast/mediastream/RTCPeerConnection-have-local-pranswer.html:
  • fast/mediastream/RTCPeerConnection-have-remote-offer.html:
  • fast/mediastream/RTCPeerConnection-have-remote-pranswer.html:
  • fast/mediastream/RTCPeerConnection-ice-expected.txt:
  • fast/mediastream/RTCPeerConnection-ice.html:
  • fast/mediastream/RTCPeerConnection-localDescription.html:
  • fast/mediastream/RTCPeerConnection-onnegotiationneeded.html:
  • fast/mediastream/RTCPeerConnection-remoteDescription.html:
  • fast/mediastream/RTCPeerConnection-stable.html:
  • fast/mediastream/RTCPeerConnection-state-expected.txt:
  • fast/mediastream/RTCPeerConnection-state.html:
  • fast/mediastream/RTCPeerConnection-stats-expected.txt:
  • fast/mediastream/RTCPeerConnection-stats.html:
  • fast/mediastream/RTCPeerConnection-statsSelector-expected.txt:
  • fast/mediastream/RTCPeerConnection-statsSelector.html:
  • fast/mediastream/RTCPeerConnection.html:
Location:
trunk
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164600 r164602  
     12014-02-24  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
     2
     3        [WebRTC] Validating RTCConfiguration according to the spec
     4        https://bugs.webkit.org/show_bug.cgi?id=129182
     5
     6        Reviewed by Eric Carlson.
     7
     8        Spec states that:
     9            - iceServers should not be an empty list
     10            - the entry in the configuration dictionary is "urls", instead of "url"
     11            - urls can be either a list or a string
     12        Fixing all that in RTCConfiguration validation when creating a RTCPeerConnection
     13
     14        * fast/mediastream/RTCPeerConnection-AddRemoveStream.html:
     15        * fast/mediastream/RTCPeerConnection-createAnswer.html:
     16        * fast/mediastream/RTCPeerConnection-createOffer.html:
     17        * fast/mediastream/RTCPeerConnection-datachannel.html:
     18        * fast/mediastream/RTCPeerConnection-dtmf.html:
     19        * fast/mediastream/RTCPeerConnection-events.html:
     20        * fast/mediastream/RTCPeerConnection-expected.txt:
     21        * fast/mediastream/RTCPeerConnection-have-local-answer.html:
     22        * fast/mediastream/RTCPeerConnection-have-local-offer.html:
     23        * fast/mediastream/RTCPeerConnection-have-local-pranswer.html:
     24        * fast/mediastream/RTCPeerConnection-have-remote-offer.html:
     25        * fast/mediastream/RTCPeerConnection-have-remote-pranswer.html:
     26        * fast/mediastream/RTCPeerConnection-ice-expected.txt:
     27        * fast/mediastream/RTCPeerConnection-ice.html:
     28        * fast/mediastream/RTCPeerConnection-localDescription.html:
     29        * fast/mediastream/RTCPeerConnection-onnegotiationneeded.html:
     30        * fast/mediastream/RTCPeerConnection-remoteDescription.html:
     31        * fast/mediastream/RTCPeerConnection-stable.html:
     32        * fast/mediastream/RTCPeerConnection-state-expected.txt:
     33        * fast/mediastream/RTCPeerConnection-state.html:
     34        * fast/mediastream/RTCPeerConnection-stats-expected.txt:
     35        * fast/mediastream/RTCPeerConnection-stats.html:
     36        * fast/mediastream/RTCPeerConnection-statsSelector-expected.txt:
     37        * fast/mediastream/RTCPeerConnection-statsSelector.html:
     38        * fast/mediastream/RTCPeerConnection.html:
     39
    1402014-02-24  Radu Stavila  <stavila@adobe.com>
    241
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream.html

    r160181 r164602  
    7676                stream = s;
    7777
    78                 pc = new webkitRTCPeerConnection({iceServers:[]});
     78                pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    7979                pc.onnegotiationneeded = onErroneousNegotiationNeeded;
    8080                shouldThrow("pc.addStream(stream, {mandatory:{invalid:1}})");
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createAnswer.html

    r160553 r164602  
    8282            }
    8383
    84             pc = new webkitRTCPeerConnection({iceServers:[]});
     84            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    8585            shouldNotThrow('pc.createAnswer(requestSucceeded1, requestFailed1);');
    8686
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html

    r160553 r164602  
    5151            }
    5252
    53             pc = new webkitRTCPeerConnection({iceServers:[]});
     53            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    5454            shouldNotThrow('pc.createOffer(requestSucceeded1, requestFailed1, {mandatory:{"succeed":true}});');
    5555
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel.html

    r158991 r164602  
    8282            }
    8383
    84             pc = new webkitRTCPeerConnection({iceServers:[]});
     84            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    8585            shouldNotThrow('dc = pc.createDataChannel("label1");');
    8686            shouldNotThrow('dc = pc.createDataChannel("label2", {});');
     
    9090            shouldNotThrow('dc = pc.createDataChannel("label3", {maxRetransmitTime:0});');
    9191
    92             pc = new webkitRTCPeerConnection({iceServers:[]});
     92            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    9393            pc.oniceconnectionstatechange = pc_onicechange;
    9494            pc.ondatachannel = pc_ondatachannel;
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-dtmf.html

    r158991 r164602  
    5353                shouldBe('stream.getVideoTracks().length', '0');
    5454
    55                 pc = new webkitRTCPeerConnection({iceServers:[]});
     55                pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    5656                pc.oniceconnectionstatechange = pc_onicechange;
    5757            }
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-events.html

    r158991 r164602  
    4242                stream = s;
    4343
    44                 pc = new webkitRTCPeerConnection({iceServers:[]});
     44                pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    4545                pc.onnegotiationneeded = onNegotiationNeeded;
    4646
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt

    r164372 r164602  
    1919PASS new webkitRTCPeerConnection(undefined, {}); threw exception TypeError: First argument of RTCPeerConnection must be a valid Dictionary.
    2020PASS new webkitRTCPeerConnection({iceServers:[]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
    21 PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
    22 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
    23 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
    24 PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com', username:'user'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
    25 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
    26 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'},{url:'stun:bar.com', username:'user2', credential:'x'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
    27 PASS new webkitRTCPeerConnection({iceServers:[]}); did not throw exception.
    28 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'none'}); did not throw exception.
    29 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay'}); did not throw exception.
    30 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'all'}); did not throw exception.
    31 PASS new webkitRTCPeerConnection({iceServers:[], requestIdentity:'yes'}); did not throw exception.
    32 PASS new webkitRTCPeerConnection({iceServers:[], requestIdentity:'no'}); did not throw exception.
    33 PASS new webkitRTCPeerConnection({iceServers:[], requestIdentity:'ifconfigured'}); did not throw exception.
    34 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'foo', requestIdentity:'bar'}); did not throw exception.
    35 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'bar'}); did not throw exception.
    36 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'foo', requestIdentity:'no'}); did not throw exception.
    37 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'yes'}); did not throw exception.
    38 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'no'}); did not throw exception.
    39 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'ifconfigured'}); did not throw exception.
    40 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay', requestIdentity:'yes'}); did not throw exception.
    41 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay', requestIdentity:'no'}); did not throw exception.
    42 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay', requestIdentity:'ifconfigured'}); did not throw exception.
    43 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'all', requestIdentity:'yes'}); did not throw exception.
    44 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'all', requestIdentity:'no'}); did not throw exception.
    45 PASS new webkitRTCPeerConnection({iceServers:[], iceTransports:'all', requestIdentity:'ifconfigured'}); did not throw exception.
    46 PASS new webkitRTCPeerConnection({iceServers:[]}, {}); did not throw exception.
    47 PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}, {}); did not throw exception.
    48 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}]}, {}); did not throw exception.
    49 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, {}); did not throw exception.
    50 PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com', username:'user'}]}, {}); did not throw exception.
    51 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'}]}, {}); did not throw exception.
    52 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'},{url:'stun:bar.com', username:'user2', credential:'x'}]}, {}); did not throw exception.
    53 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
    54 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
    55 PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com', username:'user'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
    56 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
    57 PASS new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'},{url:'stun:bar.com', username:'user2', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
     21PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
     22PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
     23PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
     24PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com', username:'user'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
     25PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
     26PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}]}, null); threw exception TypeError: Optional constraints argument of RTCPeerConnection must be a valid Dictionary.
     27PASS new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}); threw exception TypeError: Error creating RTCPeerConnection.
     28PASS new webkitRTCPeerConnection({iceServers:[{urls:'http:foo.com'}]}); threw exception TypeError: Error creating RTCPeerConnection.
     29PASS new webkitRTCPeerConnection({iceServers:[]}); threw exception TypeError: Error creating RTCPeerConnection.
     30PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}); did not throw exception.
     31PASS new webkitRTCPeerConnection({iceServers:[{urls:['stun:foo.com', 'turn:foo.com']}]}); did not throw exception.
     32PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none'}); did not throw exception.
     33PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay'}); did not throw exception.
     34PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all'}); did not throw exception.
     35PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], requestIdentity:'yes'}); did not throw exception.
     36PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], requestIdentity:'no'}); did not throw exception.
     37PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], requestIdentity:'ifconfigured'}); did not throw exception.
     38PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'foo', requestIdentity:'bar'}); did not throw exception.
     39PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'bar'}); did not throw exception.
     40PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'foo', requestIdentity:'no'}); did not throw exception.
     41PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'yes'}); did not throw exception.
     42PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'no'}); did not throw exception.
     43PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'ifconfigured'}); did not throw exception.
     44PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay', requestIdentity:'yes'}); did not throw exception.
     45PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay', requestIdentity:'no'}); did not throw exception.
     46PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay', requestIdentity:'ifconfigured'}); did not throw exception.
     47PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all', requestIdentity:'yes'}); did not throw exception.
     48PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all', requestIdentity:'no'}); did not throw exception.
     49PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all', requestIdentity:'ifconfigured'}); did not throw exception.
     50PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {}); did not throw exception.
     51PASS new webkitRTCPeerConnection({iceServers:[{urls:['stun:foo.com', 'turn:bar.com']}]}, {}); did not throw exception.
     52PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:foo.com', 'turn:bar.com']}]}, {}); did not throw exception.
     53PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'}]}, {}); did not throw exception.
     54PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'},{urls:'stun:bar.com'}]}, {}); did not throw exception.
     55PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com', username:'user'}]}, {}); did not throw exception.
     56PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'}]}, {}); did not throw exception.
     57PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}]}, {}); did not throw exception.
     58PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}]}, {}); did not throw exception.
     59PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
     60PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'},{urls:'stun:bar.com'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
     61PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com', username:'user'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
     62PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
     63PASS new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {}); did not throw exception.
    5864PASS new webkitRTCPeerConnection({fooServers:[]}, {}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    5965PASS new webkitRTCPeerConnection({iceServers:true}, {}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    6066PASS new webkitRTCPeerConnection({iceServers:[1, 2, 3]}, {}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    61 PASS new webkitRTCPeerConnection({iceServers:[{}]}, {}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    62 PASS new webkitRTCPeerConnection({iceServers:[{url:'foo'}]}, {}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    63 PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:true}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    64 PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:false}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    65 PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:{}}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    66 PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:1}}); did not throw exception.
    67 PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}}); did not throw exception.
    68 PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0}]}); did not throw exception.
    69 PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]}); did not throw exception.
    70 PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]}); did not throw exception.
     67PASS new webkitRTCPeerConnection({iceServers:[{}]}, {}); threw exception TypeError: Error creating RTCPeerConnection.
     68PASS new webkitRTCPeerConnection({iceServers:[{urls:'foo'}]}, {}); threw exception TypeError: Error creating RTCPeerConnection.
     69PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {mandatory:true}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
     70PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:false}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
     71PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:{}}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
     72PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {mandatory:{valid_and_supported_1:1}}); did not throw exception.
     73PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}}); did not throw exception.
     74PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:[{valid_and_supported_1:0}]}); did not throw exception.
     75PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]}); did not throw exception.
     76PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]}); did not throw exception.
     77PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {mandatory:{valid_and_supported_1:1}}); did not throw exception.
     78PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}}); did not throw exception.
     79PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {optional:[{valid_and_supported_1:0}]}); did not throw exception.
     80PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]}); did not throw exception.
     81PASS new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]}); did not throw exception.
    7182PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:66}}); threw exception TypeError: Error creating RTCPeerConnection.
    7283PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{invalid:1}}); threw exception TypeError: Error creating RTCPeerConnection.
    7384PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_but_unsupported_1:1}}); threw exception TypeError: Error creating RTCPeerConnection.
    7485PASS new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_but_unsupported_1:1, valid_and_supported_1:1}}); threw exception TypeError: Error creating RTCPeerConnection.
    75 PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:{valid_and_supported_1:0}}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    76 PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
     86PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:{valid_and_supported_1:0}}); threw exception TypeError: Error creating RTCPeerConnection.
     87PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception TypeError: Error creating RTCPeerConnection.
    7788PASS new webkitRTCPeerConnection({iceServers:[]}, {optional:[{invalid:0}]}); threw exception TypeError: Error creating RTCPeerConnection.
    78 PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_1:1}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    79 PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_but_unsupported_1:1}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
    80 PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception TypeError: Invalid RTCPeerConnection constructor arguments.
     89PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_1:1}); threw exception TypeError: Error creating RTCPeerConnection.
     90PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_but_unsupported_1:1}); threw exception TypeError: Error creating RTCPeerConnection.
     91PASS new webkitRTCPeerConnection({iceServers:[]}, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception TypeError: Error creating RTCPeerConnection.
    8192PASS successfullyParsed is true
    8293
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-have-local-answer.html

    r160693 r164602  
    9090            }
    9191
    92             pc = new webkitRTCPeerConnection({iceServers:[]});
     92            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    9393            shouldBe('pc.signalingState', '"stable"');
    9494            var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-have-local-offer.html

    r160693 r164602  
    2929                testPassed('setRemoteDescription succeeded.');
    3030                check("offer", "local", "pranswer", "remote", '"have-remote-pranswer"');
    31                 pc = new webkitRTCPeerConnection({iceServers:[]});
     31                pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    3232                check("", "", "", "", '"stable"');
    3333                sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
     
    110110            }
    111111
    112             pc = new webkitRTCPeerConnection({iceServers:[]});
     112            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    113113            shouldBe('pc.signalingState', '"stable"');
    114114            var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-have-local-pranswer.html

    r160693 r164602  
    106106            }
    107107
    108             pc = new webkitRTCPeerConnection({iceServers:[]});
     108            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    109109            shouldBe('pc.signalingState', '"stable"');
    110110            var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-have-remote-offer.html

    r160693 r164602  
    2929                testPassed('setLocalDescription succeeded.');
    3030                check("answer", "local", "offer", "remote", '"stable"');
    31                 pc = new webkitRTCPeerConnection({iceServers:[]});
     31                pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    3232                check("", "", "", "", '"stable"');
    3333                sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
     
    110110            }
    111111
    112             pc = new webkitRTCPeerConnection({iceServers:[]});
     112            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    113113            shouldBe('pc.signalingState', '"stable"');
    114114            var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-have-remote-pranswer.html

    r160693 r164602  
    106106            }
    107107
    108             pc = new webkitRTCPeerConnection({iceServers:[]});
     108            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    109109            shouldBe('pc.signalingState', '"stable"');
    110110            var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-ice-expected.txt

    r159938 r164602  
    44
    55
    6 PASS pc = new webkitRTCPeerConnection({iceServers:[]}); did not throw exception.
     6PASS pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}); did not throw exception.
    77PASS iceConnectionState is completed
    88PASS pc.addIceCandidate(null, null, null); threw exception TypeError: Type error.
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-ice.html

    r158991 r164602  
    4444            }
    4545
    46             shouldNotThrow('pc = new webkitRTCPeerConnection({iceServers:[]});');
     46            shouldNotThrow("pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});");
    4747            pc.oniceconnectionstatechange = onIceChange1;
    4848
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-localDescription.html

    r158991 r164602  
    4343            }
    4444
    45             pc = new webkitRTCPeerConnection({iceServers:[]});
     45            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    4646            var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
    4747            shouldNotThrow('pc.setLocalDescription(sessionDescription, requestSucceeded1, requestFailed1);');
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-onnegotiationneeded.html

    r160181 r164602  
    5151                stream = s;
    5252
    53                 pc = new webkitRTCPeerConnection({iceServers:[]});
     53                pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    5454                pc.onnegotiationneeded = onNegotiationNeeded;
    5555
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html

    r160693 r164602  
    4343            }
    4444
    45             pc = new webkitRTCPeerConnection({iceServers:[]});
     45            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    4646            var sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
    4747            shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailed1);');
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stable.html

    r160693 r164602  
    2121                testPassed('setLocalDescription succeeded.');
    2222                check("offer", "local", "", "", '"have-local-offer"')
    23                 pc = new webkitRTCPeerConnection({iceServers:[]});
     23                pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    2424                check("", "", "", "", '"stable"');
    2525                sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
     
    9696            }
    9797
    98             pc = new webkitRTCPeerConnection({iceServers:[]});
     98            pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});
    9999            shouldBe('pc.signalingState', '"stable"');
    100100            var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"local"});
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-state-expected.txt

    r159938 r164602  
    44
    55
    6 PASS pc = new webkitRTCPeerConnection({iceServers:[]}); did not throw exception.
     6PASS pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}); did not throw exception.
    77PASS pc.signalingState is "stable"
    88PASS stateChanged was called
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-state.html

    r158991 r164602  
    1717            }
    1818
    19             shouldNotThrow('pc = new webkitRTCPeerConnection({iceServers:[]});');
     19            shouldNotThrow("pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});");
    2020            shouldBeEqualToString('pc.signalingState', 'stable');
    2121            pc.onsignalingstatechange = stateChanged;
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt

    r158964 r164602  
    44
    55
    6 PASS pc = new webkitRTCPeerConnection({iceServers:[]}) did not throw exception.
     6PASS pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}) did not throw exception.
    77PASS pc.getStats(statsHandler1) did not throw exception.
    88PASS statsHandler1 was called
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html

    r158987 r164602  
    7373
    7474            var startTime = new Date().getTime();
    75             shouldNotThrow('pc = new webkitRTCPeerConnection({iceServers:[]})');
     75            shouldNotThrow("pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]})");
    7676            shouldNotThrow('pc.getStats(statsHandler1)');
    7777
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector-expected.txt

    r158964 r164602  
    44
    55
    6 PASS pc = new webkitRTCPeerConnection({iceServers:[]}) did not throw exception.
     6PASS pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}) did not throw exception.
    77PASS getUserMedia({audio:true, video:true}, gotStream) did not throw exception.
    88PASS Got a stream.
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector.html

    r158987 r164602  
    4848
    4949            var startTime = new Date().getTime();
    50             shouldNotThrow('pc = new webkitRTCPeerConnection({iceServers:[]})');
     50            shouldNotThrow("pc = new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]})");
    5151            shouldNotThrow('getUserMedia({audio:true, video:true}, gotStream)');
    5252
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection.html

    r164372 r164602  
    2323            shouldThrow("new webkitRTCPeerConnection(undefined, {});");
    2424            shouldThrow("new webkitRTCPeerConnection({iceServers:[]}, null);");
    25             shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}, null);");
    26             shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}]}, null);");
    27             shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, null);");
    28             shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com', username:'user'}]}, null);");
    29             shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'}]}, null);");
    30             shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'},{url:'stun:bar.com', username:'user2', credential:'x'}]}, null);")
     25            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, null);");
     26            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'}]}, null);");
     27            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, null);");
     28            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com', username:'user'}]}, null);");
     29            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'}]}, null);");
     30            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}]}, null);")
     31            shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]});");
     32            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'http:foo.com'}]});");
     33            shouldThrow("new webkitRTCPeerConnection({iceServers:[]});");
    3134
    32             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]});");
     35            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]});");
     36            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:['stun:foo.com', 'turn:foo.com']}]});");
    3337
    34             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none'});");
    35             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay'});");
    36             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'all'});");
    37             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], requestIdentity:'yes'});");
    38             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], requestIdentity:'no'});");
    39             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], requestIdentity:'ifconfigured'});");
    40             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'foo', requestIdentity:'bar'});");
    41             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'bar'});");
    42             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'foo', requestIdentity:'no'});");
    43             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'yes'});");
    44             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'no'});");
    45             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'none', requestIdentity:'ifconfigured'});");
    46             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay', requestIdentity:'yes'});");
    47             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay', requestIdentity:'no'});");
    48             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'relay', requestIdentity:'ifconfigured'});");
    49             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'all', requestIdentity:'yes'});");
    50             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'all', requestIdentity:'no'});");
    51             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[], iceTransports:'all', requestIdentity:'ifconfigured'});");
     38            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none'});");
     39            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay'});");
     40            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all'});");
     41            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], requestIdentity:'yes'});");
     42            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], requestIdentity:'no'});");
     43            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], requestIdentity:'ifconfigured'});");
     44            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'foo', requestIdentity:'bar'});");
     45            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'bar'});");
     46            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'foo', requestIdentity:'no'});");
     47            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'yes'});");
     48            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'no'});");
     49            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'none', requestIdentity:'ifconfigured'});");
     50            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay', requestIdentity:'yes'});");
     51            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay', requestIdentity:'no'});");
     52            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'relay', requestIdentity:'ifconfigured'});");
     53            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all', requestIdentity:'yes'});");
     54            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all', requestIdentity:'no'});");
     55            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}], iceTransports:'all', requestIdentity:'ifconfigured'});");
    5256
    53             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, {});");
    54             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com'}]}, {});");
    55             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}]}, {});");
    56             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}]}, {});");
    57             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com', username:'user'}]}, {});");
    58             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'}]}, {});");
    59             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'},{url:'stun:bar.com', username:'user2', credential:'x'}]}, {});");
     57            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {});");
     58            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:['stun:foo.com', 'turn:bar.com']}]}, {});");
     59            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:foo.com', 'turn:bar.com']}]}, {});");
     60            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'}]}, {});");
     61            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'},{urls:'stun:bar.com'}]}, {});");
     62            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com', username:'user'}]}, {});");
     63            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'}]}, {});");
     64            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}]}, {});");
     65            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:['stun:bar.com', 'turn:foo.com', 'turn:foo2.com'], username:'user2', credential:'x'}]}, {});");
    6066
    61             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
    62             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', credential:'x'},{url:'stun:bar.com'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
    63             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'stun:foo.com', username:'user'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
    64             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
    65             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{url:'turn:foo.com', username:'user', credential:'x'},{url:'stun:bar.com', username:'user2', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
     67            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
     68            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', credential:'x'},{urls:'stun:bar.com'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
     69            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com', username:'user'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
     70            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
     71            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'turn:foo.com', username:'user', credential:'x'},{urls:'stun:bar.com', username:'user2', credential:'x'}], iceTransports:'all', requestIdentity:'ifconfigured'}, {});");
    6672
    6773            shouldThrow("new webkitRTCPeerConnection({fooServers:[]}, {});");
     
    6975            shouldThrow("new webkitRTCPeerConnection({iceServers:[1, 2, 3]}, {});");
    7076            shouldThrow("new webkitRTCPeerConnection({iceServers:[{}]}, {});");
    71             shouldThrow("new webkitRTCPeerConnection({iceServers:[{url:'foo'}]}, {});");
    72             shouldThrow("new webkitRTCPeerConnection({iceServers:[]}, {mandatory:true});");
    73             shouldThrow("new webkitRTCPeerConnection({iceServers:[]}, {optional:false});");
    74             shouldThrow("new webkitRTCPeerConnection({iceServers:[]}, {optional:{}});");
     77            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'foo'}]}, {});");
     78            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {mandatory:true});");
     79            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:false});");
     80            shouldThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:{}});");
    7581
    76             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:1}});");
    77             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}});");
    78             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0}]});");
    79             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]});");
    80             shouldNotThrow("new webkitRTCPeerConnection({iceServers:[]}, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]});");
     82            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {mandatory:{valid_and_supported_1:1}});");
     83            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}});");
     84            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:[{valid_and_supported_1:0}]});");
     85            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]});");
     86            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}]}, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]});");
     87
     88            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {mandatory:{valid_and_supported_1:1}});");
     89            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {mandatory:{valid_and_supported_1:1, valid_and_supported_2:1}});");
     90            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {optional:[{valid_and_supported_1:0}]});");
     91            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {optional:[{valid_and_supported_1:0},{valid_and_supported_2:0}]});");
     92            shouldNotThrow("new webkitRTCPeerConnection({iceServers:[{urls:'stun:foo.com'}, {urls:['stun:bar.com', 'turn:foo.com']}]}, {optional:[{valid_but_unsupported_1:0},{valid_but_unsupported_2:0}]});");
    8193
    8294            shouldThrow("new webkitRTCPeerConnection({iceServers:[]}, {mandatory:{valid_and_supported_1:66}});");
  • trunk/Source/WebCore/ChangeLog

    r164600 r164602  
     12014-02-24  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
     2
     3        [WebRTC] Validating RTCConfiguration according to the spec
     4        https://bugs.webkit.org/show_bug.cgi?id=129182
     5
     6        Reviewed by Eric Carlson.
     7
     8        Spec states that:
     9            - iceServers should not be an empty list
     10            - the entry in the configuration dictionary is "urls", instead of "url"
     11            - urls can be either a list or a string
     12        Fixing all that in RTCConfiguration validation when creating a RTCPeerConnection
     13
     14        Existing tests were updated.
     15
     16        * Modules/mediastream/RTCPeerConnection.cpp:
     17        (WebCore::appendIceServer): Added.
     18        (WebCore::processIceServer): Added.
     19        (WebCore::RTCPeerConnection::parseConfiguration):
     20
    1212014-02-24  Radu Stavila  <stavila@adobe.com>
    222
  • trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp

    r164372 r164602  
    6767namespace WebCore {
    6868
     69static bool appendIceServer(const String& iceURL, const String& credential, const String& username, RTCConfiguration* rtcConfiguration)
     70{
     71    URL url(URL(), iceURL);
     72    if (url.isEmpty() || !url.isValid() || !(url.protocolIs("turn") || url.protocolIs("stun")))
     73        return false;
     74
     75    rtcConfiguration->appendServer(RTCIceServer::create(url, credential, username));
     76    return true;
     77}
     78
     79static ExceptionCode processIceServer(const Dictionary& iceServer, RTCConfiguration* rtcConfiguration)
     80{
     81    String credential, username;
     82    iceServer.get("credential", credential);
     83    iceServer.get("username", username);
     84
     85    // Spec says that "urls" can be either a string or a sequence, so we must check for both.
     86    Vector<String> urlsList;
     87    String urlString;
     88    iceServer.get("urls", urlString);
     89    // This is the only way to check if "urls" is a sequence or a string. If we try to convert
     90    // to a sequence and it fails (in case it is a string), an exception will be set and the
     91    // RTCPeerConnection will fail.
     92    // So we convert to a string always, which converts a sequence to a string in the format: "foo, bar, ..",
     93    // then checking for a comma in the string assures that a string was a sequence and then we convert
     94    // it to a sequence safely.
     95    if (urlString.find(',') != notFound && iceServer.get("urls", urlsList) && urlsList.size()) {
     96        for (auto iter = urlsList.begin(); iter != urlsList.end(); ++iter) {
     97            if (!appendIceServer((*iter), credential, username, rtcConfiguration))
     98                return INVALID_ACCESS_ERR;
     99        }
     100
     101        return 0;
     102    }
     103
     104    if (!urlString.isEmpty() && appendIceServer(urlString, credential, username, rtcConfiguration))
     105        return 0;
     106
     107    return INVALID_ACCESS_ERR;
     108}
     109
    69110PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Dictionary& configuration, ExceptionCode& ec)
    70111{
     
    81122    size_t numberOfServers;
    82123    ok = iceServers.length(numberOfServers);
    83     if (!ok) {
    84         ec = TYPE_MISMATCH_ERR;
     124    if (!ok || !numberOfServers) {
     125        ec = !ok ? TYPE_MISMATCH_ERR : INVALID_ACCESS_ERR;
    85126        return nullptr;
    86127    }
     
    104145        }
    105146
    106         String urlString, credential, username;
    107         ok = iceServer.get("url", urlString);
    108         if (!ok) {
    109             ec = TYPE_MISMATCH_ERR;
     147        ec = processIceServer(iceServer, rtcConfiguration.get());
     148        if (ec)
    110149            return nullptr;
    111         }
    112         URL url(URL(), urlString);
    113         if (!url.isValid() || !(url.protocolIs("turn") || url.protocolIs("stun"))) {
    114             ec = TYPE_MISMATCH_ERR;
    115             return nullptr;
    116         }
    117 
    118         iceServer.get("credential", credential);
    119         iceServer.get("username", username);
    120 
    121         rtcConfiguration->appendServer(RTCIceServer::create(url, credential, username));
    122150    }
    123151
Note: See TracChangeset for help on using the changeset viewer.