Changeset 202267 in webkit


Ignore:
Timestamp:
Jun 20, 2016 9:51:49 PM (8 years ago)
Author:
adam.bergkvist@ericsson.com
Message:

WebRTC: RTCIceCandidate init dictionary don't handle explicit null or undefined values correctly
https://bugs.webkit.org/show_bug.cgi?id=158873

Reviewed by Alejandro G. Castro.

Source/WebCore:

Prevent explicit null and undefined values from being converted to "null" and "undefined"
strings.

Test: Extended fast/mediastream/RTCIceCandidate.html

  • Modules/mediastream/RTCIceCandidate.cpp:

(WebCore::RTCIceCandidate::create):

LayoutTests:

Updated test to verify that explicit null and undefined values, passed to the
RTCIceCandidate init dictionary, are handled correctly.

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202264 r202267  
     12016-06-20  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: RTCIceCandidate init dictionary don't handle explicit null or undefined values correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=158873
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        Updated test to verify that explicit null and undefined values, passed to the
     9        RTCIceCandidate init dictionary, are handled correctly.
     10
     11        * fast/mediastream/RTCIceCandidate-expected.txt:
     12        * fast/mediastream/RTCIceCandidate.html:
     13
    1142016-06-20  Joseph Pecoraro  <pecoraro@apple.com>
    215
  • trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt

    r201350 r202267  
    2525PASS new RTCIceCandidate({sdpMLineIndex:6}); threw exception TypeError: Type error.
    2626
    27 One of the 'sdpMid' or 'sdpMLineIndex' members must be present.
     27One of the 'sdpMid' or 'sdpMLineIndex' members must be present (and not null or undefined).
    2828PASS new RTCIceCandidate({candidate:"foo"}); threw exception TypeError: Type error.
     29PASS new RTCIceCandidate({candidate:"foo", sdpMid: null}); threw exception TypeError: Type error.
     30PASS new RTCIceCandidate({candidate:"foo", sdpMid: undefined}); threw exception TypeError: Type error.
     31PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex: null}); threw exception TypeError: Type error.
     32PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex: undefined}); threw exception TypeError: Type error.
     33PASS new RTCIceCandidate({candidate:"foo", sdpMid: null, sdpMLineIndex: null}); threw exception TypeError: Type error.
     34PASS new RTCIceCandidate({candidate:"foo", sdpMid: undefined, sdpMLineIndex: undefined}); threw exception TypeError: Type error.
     35
     36Test that sdpMid or sdpMLineIndex explicitly set to null or undefined, results in a null value.
     37PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: null, sdpMLineIndex: 1}); did not throw exception.
     38PASS candidate.sdpMid is null
     39PASS candidate.sdpMLineIndex is 1
     40PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: undefined, sdpMLineIndex: 1}); did not throw exception.
     41PASS candidate.sdpMid is null
     42PASS candidate.sdpMLineIndex is 1
     43PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: "foo", sdpMLineIndex: null}); did not throw exception.
     44PASS candidate.sdpMid is 'foo'
     45PASS candidate.sdpMLineIndex is null
     46PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: "foo", sdpMLineIndex: undefined}); did not throw exception.
     47PASS candidate.sdpMid is 'foo'
     48PASS candidate.sdpMLineIndex is null
    2949
    3050When one of the 'sdpMid' or 'sdpMLineIndex' members is set, the other must be null.
  • trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html

    r201350 r202267  
    3535            debug("");
    3636
    37             debug("One of the 'sdpMid' or 'sdpMLineIndex' members must be present.");
     37            debug("One of the 'sdpMid' or 'sdpMLineIndex' members must be present (and not null or undefined).");
    3838            shouldThrow('new RTCIceCandidate({candidate:"foo"});');
     39            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid: null});');
     40            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid: undefined});');
     41            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMLineIndex: null});');
     42            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMLineIndex: undefined});');
     43            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid: null, sdpMLineIndex: null});');
     44            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid: undefined, sdpMLineIndex: undefined});');
     45            debug("");
     46
     47            debug("Test that sdpMid or sdpMLineIndex explicitly set to null or undefined, results in a null value.");
     48            shouldNotThrow('candidate = new RTCIceCandidate({candidate:"foo", sdpMid: null, sdpMLineIndex: 1});');
     49            shouldBeNull("candidate.sdpMid");
     50            shouldBe("candidate.sdpMLineIndex", "1");
     51
     52            shouldNotThrow('candidate = new RTCIceCandidate({candidate:"foo", sdpMid: undefined, sdpMLineIndex: 1});');
     53            shouldBeNull("candidate.sdpMid");
     54            shouldBe("candidate.sdpMLineIndex", "1");
     55
     56            shouldNotThrow('candidate = new RTCIceCandidate({candidate:"foo", sdpMid: "foo", sdpMLineIndex: null});');
     57            shouldBe("candidate.sdpMid", "'foo'");
     58            shouldBeNull("candidate.sdpMLineIndex");
     59
     60            shouldNotThrow('candidate = new RTCIceCandidate({candidate:"foo", sdpMid: "foo", sdpMLineIndex: undefined});');
     61            shouldBe("candidate.sdpMid", "'foo'");
     62            shouldBeNull("candidate.sdpMLineIndex");
    3963            debug("");
    4064
  • trunk/Source/WebCore/ChangeLog

    r202265 r202267  
     12016-06-20  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: RTCIceCandidate init dictionary don't handle explicit null or undefined values correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=158873
     5
     6        Reviewed by Alejandro G. Castro.
     7
     8        Prevent explicit null and undefined values from being converted to "null" and "undefined"
     9        strings.
     10
     11        Test: Extended fast/mediastream/RTCIceCandidate.html
     12
     13        * Modules/mediastream/RTCIceCandidate.cpp:
     14        (WebCore::RTCIceCandidate::create):
     15
    1162016-06-20  Commit Queue  <commit-queue@webkit.org>
    217
  • trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp

    r198492 r202267  
    5151
    5252    String sdpMid;
    53     dictionary.get("sdpMid", sdpMid);
     53    dictionary.getWithUndefinedOrNullCheck("sdpMid", sdpMid);
    5454
    5555    Optional<unsigned short> sdpMLineIndex;
    5656    String sdpMLineIndexString;
    5757
    58     if (dictionary.get("sdpMLineIndex", sdpMLineIndexString)) {
     58    if (dictionary.getWithUndefinedOrNullCheck("sdpMLineIndex", sdpMLineIndexString)) {
    5959        bool intConversionOk;
    6060        unsigned result = sdpMLineIndexString.toUIntStrict(&intConversionOk);
Note: See TracChangeset for help on using the changeset viewer.