Changeset 159349 in webkit


Ignore:
Timestamp:
Nov 15, 2013 11:34:16 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Modifying RTCIceCandidate object construction to match the spec
https://bugs.webkit.org/show_bug.cgi?id=124369

Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-11-15
Reviewed by Eric Carlson.

According to the spec the RTCIceCandidateInit parameter in RTCSessionDescription constructor is optional,
which must not be nullable, and, if passed, must be a valid Dictionary. If the keys are not present, the string
object that stores them in the RTCIceCandidate class, must be null in those cases. Also, if a key is present
and its value is not valid an exception must be raised.

Source/WebCore:

Existing test was updated.

  • GNUmakefile.list.am:
  • Modules/mediastream/RTCIceCandidate.cpp:

(WebCore::RTCIceCandidate::create):

  • Modules/mediastream/RTCIceCandidate.idl:
  • UseJSC.cmake:
  • WebCore.vcxproj/WebCore.vcxproj:
  • WebCore.vcxproj/WebCore.vcxproj.filters:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSRTCIceCandidateCustom.cpp: Added.

(WebCore::JSRTCIceCandidateConstructor::constructJSRTCIceCandidate):

LayoutTests:

  • fast/mediastream/RTCIceCandidate-expected.txt:
  • fast/mediastream/RTCIceCandidate.html:
Location:
trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159348 r159349  
     12013-11-15  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
     2
     3        Modifying RTCIceCandidate object construction to match the spec
     4        https://bugs.webkit.org/show_bug.cgi?id=124369
     5
     6        Reviewed by Eric Carlson.
     7
     8        According to the spec the RTCIceCandidateInit parameter in RTCSessionDescription constructor is optional,
     9        which must not be nullable, and, if passed, must be a valid Dictionary. If the keys are not present, the string
     10        object that stores them in the RTCIceCandidate class, must be null in those cases. Also, if a key is present
     11        and its value is not valid an exception must be raised.
     12
     13        * fast/mediastream/RTCIceCandidate-expected.txt:
     14        * fast/mediastream/RTCIceCandidate.html:
     15
    1162013-11-15  Tim Horton  <timothy_horton@apple.com>
    217
  • trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt

    r134954 r159349  
    1313PASS candidate.sdpMid is "bar"
    1414PASS candidate.sdpMLineIndex is 6
    15 PASS new RTCIceCandidate({}); threw exception Error: TypeMismatchError: DOM Exception 17.
    16 PASS new RTCIceCandidate(5); threw exception TypeError: Not an object..
    17 PASS new RTCIceCandidate("foobar"); threw exception TypeError: Not an object..
    18 PASS new RTCIceCandidate(candidate:""); threw exception SyntaxError: Unexpected token :.
    19 PASS new RTCIceCandidate({candidate:"x"}); did not throw exception.
     15PASS new RTCIceCandidate({}); did not throw exception.
     16PASS new RTCIceCandidate({candidate:"foo"}); did not throw exception.
     17PASS new RTCIceCandidate({sdpMid:"bar"}); did not throw exception.
     18PASS new RTCIceCandidate({sdpMLineIndex:6}); did not throw exception.
     19PASS new RTCIceCandidate({candidate:"foo", sdpMid:"bar", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     20PASS new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     21PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     22PASS new RTCIceCandidate({sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     23PASS new RTCIceCandidate({candidate:"", sdpMid:"bar", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     24PASS new RTCIceCandidate({candidate:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     25PASS new RTCIceCandidate({candidate:"", sdpMid:"bar"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     26PASS new RTCIceCandidate({candidate:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     27PASS new RTCIceCandidate({candidate:"foo", sdpMid:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     28PASS new RTCIceCandidate({sdpMid:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     29PASS new RTCIceCandidate({candidate:"foo", sdpMid:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     30PASS new RTCIceCandidate({sdpMid:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     31PASS new RTCIceCandidate({candidate:"", sdpMid:"", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
     32PASS new RTCIceCandidate(5); threw exception TypeError: Optional RTCIceCandidate constructor argument must be a valid Dictionary.
     33PASS new RTCIceCandidate("foobar"); threw exception TypeError: Optional RTCIceCandidate constructor argument must be a valid Dictionary.
     34PASS new RTCIceCandidate(candidate:""); threw exception SyntaxError: Unexpected token ':'. Expected ')' to end a argument list..
    2035PASS successfullyParsed is true
    2136
  • trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html

    r158987 r159349  
    2424            shouldBe('candidate.sdpMLineIndex', '6');
    2525
    26             shouldThrow('new RTCIceCandidate({});');
     26            shouldNotThrow('new RTCIceCandidate({});');
     27            shouldNotThrow('new RTCIceCandidate({candidate:"foo"});');
     28            shouldNotThrow('new RTCIceCandidate({sdpMid:"bar"});');
     29            shouldNotThrow('new RTCIceCandidate({sdpMLineIndex:6});');
     30
     31            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:"bar", sdpMLineIndex:"a"});');
     32            shouldThrow('new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:"a"});');
     33            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"});');
     34            shouldThrow('new RTCIceCandidate({sdpMLineIndex:"a"});');
     35
     36            shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"bar", sdpMLineIndex:6});');
     37            shouldThrow('new RTCIceCandidate({candidate:"", sdpMLineIndex:6});');
     38            shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"bar"});');
     39            shouldThrow('new RTCIceCandidate({candidate:""});');
     40
     41            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:"", sdpMLineIndex:6});');
     42            shouldThrow('new RTCIceCandidate({sdpMid:"", sdpMLineIndex:6});');
     43            shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:""});');
     44            shouldThrow('new RTCIceCandidate({sdpMid:""});');
     45
     46            shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"", sdpMLineIndex:"a"});');
     47
    2748            shouldThrow('new RTCIceCandidate(5);');
    2849            shouldThrow('new RTCIceCandidate("foobar");');
    2950            shouldThrow('new RTCIceCandidate(candidate:"");');
    30 
    31             shouldNotThrow('new RTCIceCandidate({candidate:"x"});');
    3251
    3352            window.successfullyParsed = true;
  • trunk/Source/WebCore/ChangeLog

    r159347 r159349  
     12013-11-15  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
     2
     3        Modifying RTCIceCandidate object construction to match the spec
     4        https://bugs.webkit.org/show_bug.cgi?id=124369
     5
     6        Reviewed by Eric Carlson.
     7
     8        According to the spec the RTCIceCandidateInit parameter in RTCSessionDescription constructor is optional,
     9        which must not be nullable, and, if passed, must be a valid Dictionary. If the keys are not present, the string
     10        object that stores them in the RTCIceCandidate class, must be null in those cases. Also, if a key is present
     11        and its value is not valid an exception must be raised.
     12
     13        Existing test was updated.
     14
     15        * GNUmakefile.list.am:
     16        * Modules/mediastream/RTCIceCandidate.cpp:
     17        (WebCore::RTCIceCandidate::create):
     18        * Modules/mediastream/RTCIceCandidate.idl:
     19        * UseJSC.cmake:
     20        * WebCore.vcxproj/WebCore.vcxproj:
     21        * WebCore.vcxproj/WebCore.vcxproj.filters:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * bindings/js/JSRTCIceCandidateCustom.cpp: Added.
     24        (WebCore::JSRTCIceCandidateConstructor::constructJSRTCIceCandidate):
     25
    1262013-11-15  Commit Queue  <commit-queue@webkit.org>
    227
  • trunk/Source/WebCore/GNUmakefile.list.am

    r159335 r159349  
    23892389        Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp \
    23902390        Source/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp \
     2391        Source/WebCore/bindings/js/JSRTCIceCandidateCustom.cpp \
    23912392        Source/WebCore/bindings/js/JSRTCPeerConnectionCustom.cpp \
    23922393        Source/WebCore/bindings/js/JSRTCSessionDescriptionCustom.cpp \
  • trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp

    r134440 r159349  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    4647    String candidate;
    4748    bool ok = dictionary.get("candidate", candidate);
    48     if (!ok || !candidate.length()) {
     49    if (ok && candidate.isEmpty()) {
    4950        ec = TYPE_MISMATCH_ERR;
    5051        return 0;
     
    5253
    5354    String sdpMid;
    54     dictionary.get("sdpMid", sdpMid);
     55    ok = dictionary.get("sdpMid", sdpMid);
     56    if (ok && sdpMid.isEmpty()) {
     57        ec = TYPE_MISMATCH_ERR;
     58        return 0;
     59    }
    5560
     61    String tempLineIndex;
    5662    unsigned short sdpMLineIndex = 0;
    57     dictionary.get("sdpMLineIndex", sdpMLineIndex);
     63    // First we check if the property exists in the Dictionary.
     64    ok = dictionary.get("sdpMLineIndex", tempLineIndex);
     65    // Then we try to convert it to a number and check if it was successful.
     66    if (ok) {
     67        bool intConversionOk;
     68        sdpMLineIndex = tempLineIndex.toUIntStrict(&intConversionOk);
     69        if (!intConversionOk) {
     70            ec = TYPE_MISMATCH_ERR;
     71            return 0;
     72        }
     73    }
    5874
    5975    return adoptRef(new RTCIceCandidate(RTCIceCandidateDescriptor::create(candidate, sdpMid, sdpMLineIndex)));
  • trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl

    r151487 r159349  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3132[
    3233    Conditional=MEDIA_STREAM,
    33     Constructor(Dictionary dictionary),
     34    CustomConstructor(optional Dictionary dictionary),
    3435    ConstructorRaisesException
    3536] interface RTCIceCandidate {
  • trunk/Source/WebCore/UseJSC.cmake

    r159230 r159349  
    244244        bindings/js/JSMediaSourceStatesCustom.cpp
    245245        bindings/js/JSMediaStreamCapabilitiesCustom.cpp
     246        bindings/js/JSRTCIceCandidateCustom.cpp
    246247        bindings/js/JSRTCPeerConnectionCustom.cpp
    247248        bindings/js/JSRTCSessionDescriptionCustom.cpp
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r159270 r159349  
    1688116881    </ClCompile>
    1688216882    <ClCompile Include="..\bindings\js\JSSQLTransactionSyncCustom.cpp">
     16883      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     16884      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     16885      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
     16886      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     16887      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
     16888      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
     16889      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     16890      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     16891      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     16892      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     16893      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     16894      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     16895    </ClCompile>
     16896    <ClCompile Include="..\bindings\js\JSRTCIceCandidateCustom.cpp">
    1688316897      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    1688416898      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r159270 r159349  
    44744474      <Filter>bindings\js</Filter>
    44754475    </ClCompile>
     4476    <ClCompile Include="..\bindings\js\JSRTCIceCandidateCustom.cpp">
     4477      <Filter>bindings\js</Filter>
     4478    </ClCompile>
    44764479    <ClCompile Include="..\bindings\js\JSRTCPeerConnectionCustom.cpp">
    44774480      <Filter>bindings\js</Filter>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r159292 r159349  
    15681568                4AD0173C127E82860015035F /* JSHTMLOutputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD0173A127E82860015035F /* JSHTMLOutputElement.cpp */; };
    15691569                4AD0173D127E82860015035F /* JSHTMLOutputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD0173B127E82860015035F /* JSHTMLOutputElement.h */; };
     1570                4AE0BF891836084400F3852D /* JSRTCIceCandidateCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AE0BF881836083100F3852D /* JSRTCIceCandidateCustom.cpp */; };
    15701571                4B2708C70AF19EE40065127F /* Pasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B2708C50AF19EE40065127F /* Pasteboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15711572                4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2709810AF2E5E00065127F /* PasteboardMac.mm */; };
     
    82608261                4AD0173A127E82860015035F /* JSHTMLOutputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOutputElement.cpp; sourceTree = "<group>"; };
    82618262                4AD0173B127E82860015035F /* JSHTMLOutputElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLOutputElement.h; sourceTree = "<group>"; };
     8263                4AE0BF881836083100F3852D /* JSRTCIceCandidateCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCIceCandidateCustom.cpp; sourceTree = "<group>"; };
    82628264                4B2708C50AF19EE40065127F /* Pasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pasteboard.h; sourceTree = "<group>"; };
    82638265                4B2709810AF2E5E00065127F /* PasteboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteboardMac.mm; sourceTree = "<group>"; };
     
    1961319615                        isa = PBXGroup;
    1961419616                        children = (
     19617                                4AE0BF881836083100F3852D /* JSRTCIceCandidateCustom.cpp */,
    1961519618                                07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */,
    1961619619                                0705851617FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp */,
     
    2587525878                                AD6E71AC1668899D00320C13 /* DocumentSharedObjectPool.cpp in Sources */,
    2587625879                                2D46F04E17B96FBD005647F0 /* IntPoint.cpp in Sources */,
     25880                                4AE0BF891836084400F3852D /* JSRTCIceCandidateCustom.cpp in Sources */,
    2587725881                                E47E276816036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp in Sources */,
    2587825882                                0B9056190F2578BE0095FF6A /* DocumentThreadableLoader.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.