Changeset 134245 in webkit


Ignore:
Timestamp:
Nov 12, 2012 8:34:45 AM (11 years ago)
Author:
tommyw@google.com
Message:

MediaStream API: Make sure that MediaConstraints only has optional and mandatory at the top level
https://bugs.webkit.org/show_bug.cgi?id=101733

Reviewed by Jochen Eisinger.

Source/WebCore:

This patch adds better verification to MediaConstraintsImpl.

Existing tests expanded to cover this change.

  • Modules/mediastream/MediaConstraintsImpl.cpp:

(WebCore::MediaConstraintsImpl::initialize):

LayoutTests:

This patch adds more tests for MediaConstraints.

  • fast/mediastream/RTCPeerConnection-expected.txt:
  • fast/mediastream/RTCPeerConnection.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r134243 r134245  
     12012-11-12  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API: Make sure that MediaConstraints only has optional and mandatory at the top level
     4        https://bugs.webkit.org/show_bug.cgi?id=101733
     5
     6        Reviewed by Jochen Eisinger.
     7
     8        This patch adds more tests for MediaConstraints.
     9
     10        * fast/mediastream/RTCPeerConnection-expected.txt:
     11        * fast/mediastream/RTCPeerConnection.html:
     12
    1132012-11-12  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    214
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection-expected.txt

    r128982 r134245  
    3232PASS new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    3333PASS new webkitRTCPeerConnection(null, {optional:[{invalid:0}]}); threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
     34PASS new webkitRTCPeerConnection(null, {valid_and_supported_1:1}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     35PASS new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     36PASS new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}}); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    3437PASS successfullyParsed is true
    3538
  • trunk/LayoutTests/fast/mediastream/RTCPeerConnection.html

    r128982 r134245  
    3838shouldThrow("new webkitRTCPeerConnection(null, {optional:[{valid_and_supported_1:0,valid_and_supported_2:0}]});");
    3939shouldThrow("new webkitRTCPeerConnection(null, {optional:[{invalid:0}]});");
     40shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_1:1});");
     41shouldThrow("new webkitRTCPeerConnection(null, {valid_but_unsupported_1:1});");
     42shouldThrow("new webkitRTCPeerConnection(null, {valid_and_supported_2:1, mandatory:{valid_and_supported_1:1}});");
    4043</script>
    4144<script src="../js/resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r134244 r134245  
     12012-11-12  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API: Make sure that MediaConstraints only has optional and mandatory at the top level
     4        https://bugs.webkit.org/show_bug.cgi?id=101733
     5
     6        Reviewed by Jochen Eisinger.
     7
     8        This patch adds better verification to MediaConstraintsImpl.
     9
     10        Existing tests expanded to cover this change.
     11
     12        * Modules/mediastream/MediaConstraintsImpl.cpp:
     13        (WebCore::MediaConstraintsImpl::initialize):
     14
    1152012-11-12  Sheriff Bot  <webkit.review.bot@gmail.com>
    216
  • trunk/Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp

    r130612 r134245  
    6666
    6767    String mandatory = ASCIILiteral("mandatory");
     68    String optional = ASCIILiteral("optional");
     69
     70    for (Vector<String>::iterator it = names.begin(); it != names.end(); ++it) {
     71        if (*it != mandatory && *it != optional)
     72            return false;
     73    }
     74
    6875    if (names.contains(mandatory)) {
    6976        Dictionary mandatoryConstraints;
     
    7784    }
    7885
    79     String optional = ASCIILiteral("optional");
    8086    if (names.contains(optional)) {
    8187        ArrayValue optionalConstraints;
Note: See TracChangeset for help on using the changeset viewer.