Changeset 159230 in webkit


Ignore:
Timestamp:
Nov 13, 2013 1:26:48 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

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

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

According to the spec the RTCSessionDescriptionInit parameter in RTCSessionDescription constructor is optional,
which must not be nullable. If the 'type' and/or 'sdp' keys are not present, the string object that stores
them in the RTCSessionDescription class, must be null in those cases. Also, if an object that is not a
Dictionary is passed as argument to the constructor, an exception must be raised.

Source/WebCore:

Existing test was updated.

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

(WebCore::RTCSessionDescription::create):

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

(WebCore::JSRTCSessionDescriptionConstructor::constructJSRTCSessionDescription):

LayoutTests:

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159219 r159230  
     12013-11-13  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
     2
     3        Modifying RTCSessionDescription object construction to match the spec
     4        https://bugs.webkit.org/show_bug.cgi?id=124212
     5
     6        Reviewed by Eric Carlson.
     7
     8        According to the spec the RTCSessionDescriptionInit parameter in RTCSessionDescription constructor is optional,
     9        which must not be nullable. If the 'type' and/or 'sdp' keys are not present, the string object that stores
     10        them in the RTCSessionDescription class, must be null in those cases. Also, if an object that is not a
     11        Dictionary is passed as argument to the constructor, an exception must be raised.
     12
     13        * fast/mediastream/RTCSessionDescription-expected.txt:
     14        * fast/mediastream/RTCSessionDescription.html:
     15
    1162013-11-09  Martin Robinson  <mrobinson@igalia.com>
    217
  • trunk/LayoutTests/fast/mediastream/RTCSessionDescription-expected.txt

    r134954 r159230  
    44
    55
     6PASS sessionDescription = new RTCSessionDescription(); did not throw exception.
    67PASS sessionDescription = new RTCSessionDescription(initializer); did not throw exception.
    78PASS sessionDescription.type is "offer"
     
    1112PASS sessionDescription.type is "offer"
    1213PASS sessionDescription.sdp is "foobar"
    13 PASS new RTCSessionDescription({}); threw exception Error: TypeMismatchError: DOM Exception 17.
    14 PASS new RTCSessionDescription(5); threw exception TypeError: Not an object..
    15 PASS new RTCSessionDescription('foobar'); threw exception TypeError: Not an object..
    16 PASS new RTCSessionDescription({type:'foobar', sdp:'x'}); threw exception Error: TypeMismatchError: DOM Exception 17.
    17 PASS new RTCSessionDescription({type:'offer', sdp:''}); threw exception Error: TypeMismatchError: DOM Exception 17.
     14PASS new RTCSessionDescription(null); threw exception TypeError: Optional description init argument of RTCSessionDescription must be a valid Dictionary.
     15PASS new RTCSessionDescription(5); threw exception TypeError: Optional description init argument of RTCSessionDescription must be a valid Dictionary.
     16PASS new RTCSessionDescription('foobar'); threw exception TypeError: Optional description init argument of RTCSessionDescription must be a valid Dictionary.
     17PASS new RTCSessionDescription({type:'foobar', sdp:'x'}); threw exception TypeError: Invalid RTCSessionDescription constructor arguments.
     18PASS new RTCSessionDescription({type:'offer', sdp:''}); threw exception TypeError: Invalid RTCSessionDescription constructor arguments.
     19PASS new RTCSessionDescription({}); did not throw exception.
    1820PASS new RTCSessionDescription({type:'offer', sdp:'x'}); did not throw exception.
    1921PASS new RTCSessionDescription({type:'answer', sdp:'x'}); did not throw exception.
  • trunk/LayoutTests/fast/mediastream/RTCSessionDescription.html

    r158987 r159230  
    1212            var initializer = {type:"offer", sdp:"foobar"};
    1313            var sessionDescription;
     14            shouldNotThrow("sessionDescription = new RTCSessionDescription();");
    1415            shouldNotThrow("sessionDescription = new RTCSessionDescription(initializer);");
    1516            shouldBe('sessionDescription.type', '"offer"');
     
    2223            shouldBe('sessionDescription.sdp', '"foobar"');
    2324
    24             shouldThrow("new RTCSessionDescription({});");
     25            shouldThrow("new RTCSessionDescription(null);");
    2526            shouldThrow("new RTCSessionDescription(5);");
    2627            shouldThrow("new RTCSessionDescription('foobar');");
     
    2829            shouldThrow("new RTCSessionDescription({type:'offer', sdp:''});");
    2930
     31            shouldNotThrow("new RTCSessionDescription({});");
    3032            shouldNotThrow("new RTCSessionDescription({type:'offer', sdp:'x'});");
    3133            shouldNotThrow("new RTCSessionDescription({type:'answer', sdp:'x'});");
  • trunk/Source/WebCore/ChangeLog

    r159226 r159230  
     12013-11-13  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
     2
     3        Modifying RTCSessionDescription object construction to match the spec
     4        https://bugs.webkit.org/show_bug.cgi?id=124212
     5
     6        Reviewed by Eric Carlson.
     7
     8        According to the spec the RTCSessionDescriptionInit parameter in RTCSessionDescription constructor is optional,
     9        which must not be nullable. If the 'type' and/or 'sdp' keys are not present, the string object that stores
     10        them in the RTCSessionDescription class, must be null in those cases. Also, if an object that is not a
     11        Dictionary is passed as argument to the constructor, an exception must be raised.
     12
     13        Existing test was updated.
     14
     15        * GNUmakefile.list.am:
     16        * Modules/mediastream/RTCSessionDescription.cpp:
     17        (WebCore::RTCSessionDescription::create):
     18        * Modules/mediastream/RTCSessionDescription.idl:
     19        * UseJSC.cmake:
     20        * WebCore.vcxproj/WebCore.vcxproj:
     21        * WebCore.vcxproj/WebCore.vcxproj.filters:
     22        * WebCore.xcodeproj/project.pbxproj:
     23        * bindings/js/JSRTCSessionDescriptionCustom.cpp: Added.
     24        (WebCore::JSRTCSessionDescriptionConstructor::constructJSRTCSessionDescription):
     25
    1262013-11-13  Tim Horton  <timothy_horton@apple.com>
    227
  • trunk/Source/WebCore/GNUmakefile.list.am

    r159162 r159230  
    23902390        Source/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp \
    23912391        Source/WebCore/bindings/js/JSRTCPeerConnectionCustom.cpp \
     2392        Source/WebCore/bindings/js/JSRTCSessionDescriptionCustom.cpp \
    23922393        Source/WebCore/bindings/js/JSRTCStatsResponseCustom.cpp \
    23932394        Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp \
  • trunk/Source/WebCore/Modules/mediastream/RTCSessionDescription.cpp

    r155057 r159230  
    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
     
    5051    String type;
    5152    bool ok = dictionary.get("type", type);
    52     if (!ok || !verifyType(type)) {
     53    if (ok && !verifyType(type)) {
    5354        ec = TYPE_MISMATCH_ERR;
    5455        return 0;
     
    5758    String sdp;
    5859    ok = dictionary.get("sdp", sdp);
    59     if (!ok || sdp.isEmpty()) {
     60    if (ok && sdp.isEmpty()) {
    6061        ec = TYPE_MISMATCH_ERR;
    6162        return 0;
  • trunk/Source/WebCore/Modules/mediastream/RTCSessionDescription.idl

    r155057 r159230  
    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 RTCSessionDescription {
  • trunk/Source/WebCore/UseJSC.cmake

    r158964 r159230  
    245245        bindings/js/JSMediaStreamCapabilitiesCustom.cpp
    246246        bindings/js/JSRTCPeerConnectionCustom.cpp
     247        bindings/js/JSRTCSessionDescriptionCustom.cpp
    247248        bindings/js/JSRTCStatsResponseCustom.cpp
    248249    )
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r159162 r159230  
    1689516895    </ClCompile>
    1689616896    <ClCompile Include="..\bindings\js\JSRTCPeerConnectionCustom.cpp">
     16897      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
     16898      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     16899      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
     16900      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
     16901      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
     16902      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
     16903      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
     16904      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
     16905      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
     16906      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
     16907      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     16908      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     16909    </ClCompile>
     16910    <ClCompile Include="..\bindings\js\JSRTCSessionDescriptionCustom.cpp">
    1689716911      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    1689816912      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r159162 r159230  
    44774477      <Filter>bindings\js</Filter>
    44784478    </ClCompile>
     4479    <ClCompile Include="..\bindings\js\JSRTCSessionDescriptionCustom.cpp">
     4480      <Filter>bindings\js</Filter>
     4481    </ClCompile>
    44794482    <ClCompile Include="..\bindings\js\JSRTCStatsResponseCustom.cpp">
    44804483      <Filter>bindings\js</Filter>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r159180 r159230  
    322322                07CA120E182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */; };
    323323                07CE77D516712A6A00C55A47 /* InbandTextTrackPrivateClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
     324                07D07B141834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */; };
    324325                07DC5FD417D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07DC5FD317D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp */; };
    325326                07E116B11489C9A100EC5ACE /* JSTextTrackCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */; };
     
    68636864                07CA120D182D67D800D12197 /* JSRTCPeerConnectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCPeerConnectionCustom.cpp; sourceTree = "<group>"; };
    68646865                07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; };
     6866                07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCSessionDescriptionCustom.cpp; sourceTree = "<group>"; };
    68656867                07DC5FD317D3EEE90099F890 /* JSRTCStatsResponseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCStatsResponseCustom.cpp; sourceTree = "<group>"; };
    68666868                07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCustom.cpp; sourceTree = "<group>"; };
     
    1961319615                        isa = PBXGroup;
    1961419616                        children = (
     19617                                07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */,
    1961519618                                0705851617FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp */,
    1961619619                                07C59B6D17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp */,
     
    2570425707                                97627B8D14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp in Sources */,
    2570525708                                065AD4F60B0C2EDA005A2B1D /* ContextMenuController.cpp in Sources */,
     25709                                07D07B141834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp in Sources */,
    2570625710                                06027CB30B1CC03D00884B2D /* ContextMenuItemMac.mm in Sources */,
    2570725711                                93B6A0EA0B0BCA8400F5027A /* ContextMenuMac.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.