Diff
Modified: trunk/LayoutTests/ChangeLog (159348 => 159349)
--- trunk/LayoutTests/ChangeLog 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/LayoutTests/ChangeLog 2013-11-15 19:34:16 UTC (rev 159349)
@@ -1,3 +1,18 @@
+2013-11-15 Thiago de Barros Lacerda <thiago.lace...@openbossa.org>
+
+ Modifying RTCIceCandidate object construction to match the spec
+ https://bugs.webkit.org/show_bug.cgi?id=124369
+
+ 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.
+
+ * fast/mediastream/RTCIceCandidate-expected.txt:
+ * fast/mediastream/RTCIceCandidate.html:
+
2013-11-15 Tim Horton <timothy_hor...@apple.com>
Layout Test webgl/1.0.2/conformance/ogles/GL/tan/tan_001_to_006.html fails on Intel
Modified: trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt (159348 => 159349)
--- trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt 2013-11-15 19:34:16 UTC (rev 159349)
@@ -12,11 +12,26 @@
PASS candidate.candidate is "foo"
PASS candidate.sdpMid is "bar"
PASS candidate.sdpMLineIndex is 6
-PASS new RTCIceCandidate({}); threw exception Error: TypeMismatchError: DOM Exception 17.
-PASS new RTCIceCandidate(5); threw exception TypeError: Not an object..
-PASS new RTCIceCandidate("foobar"); threw exception TypeError: Not an object..
-PASS new RTCIceCandidate(candidate:""); threw exception SyntaxError: Unexpected token :.
-PASS new RTCIceCandidate({candidate:"x"}); did not throw exception.
+PASS new RTCIceCandidate({}); did not throw exception.
+PASS new RTCIceCandidate({candidate:"foo"}); did not throw exception.
+PASS new RTCIceCandidate({sdpMid:"bar"}); did not throw exception.
+PASS new RTCIceCandidate({sdpMLineIndex:6}); did not throw exception.
+PASS new RTCIceCandidate({candidate:"foo", sdpMid:"bar", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:"", sdpMid:"bar", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:"", sdpMid:"bar"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:"foo", sdpMid:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({sdpMid:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:"foo", sdpMid:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({sdpMid:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate({candidate:"", sdpMid:"", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments.
+PASS new RTCIceCandidate(5); threw exception TypeError: Optional RTCIceCandidate constructor argument must be a valid Dictionary.
+PASS new RTCIceCandidate("foobar"); threw exception TypeError: Optional RTCIceCandidate constructor argument must be a valid Dictionary.
+PASS new RTCIceCandidate(candidate:""); threw exception SyntaxError: Unexpected token ':'. Expected ')' to end a argument list..
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html (159348 => 159349)
--- trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html 2013-11-15 19:34:16 UTC (rev 159349)
@@ -23,13 +23,32 @@
shouldBe('candidate.sdpMid', '"bar"');
shouldBe('candidate.sdpMLineIndex', '6');
- shouldThrow('new RTCIceCandidate({});');
+ shouldNotThrow('new RTCIceCandidate({});');
+ shouldNotThrow('new RTCIceCandidate({candidate:"foo"});');
+ shouldNotThrow('new RTCIceCandidate({sdpMid:"bar"});');
+ shouldNotThrow('new RTCIceCandidate({sdpMLineIndex:6});');
+
+ shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:"bar", sdpMLineIndex:"a"});');
+ shouldThrow('new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:"a"});');
+ shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"});');
+ shouldThrow('new RTCIceCandidate({sdpMLineIndex:"a"});');
+
+ shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"bar", sdpMLineIndex:6});');
+ shouldThrow('new RTCIceCandidate({candidate:"", sdpMLineIndex:6});');
+ shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"bar"});');
+ shouldThrow('new RTCIceCandidate({candidate:""});');
+
+ shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:"", sdpMLineIndex:6});');
+ shouldThrow('new RTCIceCandidate({sdpMid:"", sdpMLineIndex:6});');
+ shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:""});');
+ shouldThrow('new RTCIceCandidate({sdpMid:""});');
+
+ shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"", sdpMLineIndex:"a"});');
+
shouldThrow('new RTCIceCandidate(5);');
shouldThrow('new RTCIceCandidate("foobar");');
shouldThrow('new RTCIceCandidate(candidate:"");');
- shouldNotThrow('new RTCIceCandidate({candidate:"x"});');
-
window.successfullyParsed = true;
</script>
<script src=""
Modified: trunk/Source/WebCore/ChangeLog (159348 => 159349)
--- trunk/Source/WebCore/ChangeLog 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/ChangeLog 2013-11-15 19:34:16 UTC (rev 159349)
@@ -1,3 +1,28 @@
+2013-11-15 Thiago de Barros Lacerda <thiago.lace...@openbossa.org>
+
+ Modifying RTCIceCandidate object construction to match the spec
+ https://bugs.webkit.org/show_bug.cgi?id=124369
+
+ 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.
+
+ 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):
+
2013-11-15 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r159337.
Modified: trunk/Source/WebCore/GNUmakefile.list.am (159348 => 159349)
--- trunk/Source/WebCore/GNUmakefile.list.am 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2013-11-15 19:34:16 UTC (rev 159349)
@@ -2388,6 +2388,7 @@
Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \
Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp \
Source/WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp \
+ Source/WebCore/bindings/js/JSRTCIceCandidateCustom.cpp \
Source/WebCore/bindings/js/JSRTCPeerConnectionCustom.cpp \
Source/WebCore/bindings/js/JSRTCSessionDescriptionCustom.cpp \
Source/WebCore/bindings/js/JSRTCStatsResponseCustom.cpp \
Modified: trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp (159348 => 159349)
--- trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp 2013-11-15 19:34:16 UTC (rev 159349)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -45,16 +46,31 @@
{
String candidate;
bool ok = dictionary.get("candidate", candidate);
- if (!ok || !candidate.length()) {
+ if (ok && candidate.isEmpty()) {
ec = TYPE_MISMATCH_ERR;
return 0;
}
String sdpMid;
- dictionary.get("sdpMid", sdpMid);
+ ok = dictionary.get("sdpMid", sdpMid);
+ if (ok && sdpMid.isEmpty()) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+ String tempLineIndex;
unsigned short sdpMLineIndex = 0;
- dictionary.get("sdpMLineIndex", sdpMLineIndex);
+ // First we check if the property exists in the Dictionary.
+ ok = dictionary.get("sdpMLineIndex", tempLineIndex);
+ // Then we try to convert it to a number and check if it was successful.
+ if (ok) {
+ bool intConversionOk;
+ sdpMLineIndex = tempLineIndex.toUIntStrict(&intConversionOk);
+ if (!intConversionOk) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+ }
return adoptRef(new RTCIceCandidate(RTCIceCandidateDescriptor::create(candidate, sdpMid, sdpMLineIndex)));
}
Modified: trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl (159348 => 159349)
--- trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl 2013-11-15 19:34:16 UTC (rev 159349)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,7 +31,7 @@
[
Conditional=MEDIA_STREAM,
- Constructor(Dictionary dictionary),
+ CustomConstructor(optional Dictionary dictionary),
ConstructorRaisesException
] interface RTCIceCandidate {
readonly attribute DOMString candidate;
Modified: trunk/Source/WebCore/UseJSC.cmake (159348 => 159349)
--- trunk/Source/WebCore/UseJSC.cmake 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/UseJSC.cmake 2013-11-15 19:34:16 UTC (rev 159349)
@@ -243,6 +243,7 @@
list(APPEND WebCore_SOURCES
bindings/js/JSMediaSourceStatesCustom.cpp
bindings/js/JSMediaStreamCapabilitiesCustom.cpp
+ bindings/js/JSRTCIceCandidateCustom.cpp
bindings/js/JSRTCPeerConnectionCustom.cpp
bindings/js/JSRTCSessionDescriptionCustom.cpp
bindings/js/JSRTCStatsResponseCustom.cpp
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (159348 => 159349)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj 2013-11-15 19:34:16 UTC (rev 159349)
@@ -16893,6 +16893,20 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="..\bindings\js\JSRTCIceCandidateCustom.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="..\bindings\js\JSRTCPeerConnectionCustom.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (159348 => 159349)
--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters 2013-11-15 19:34:16 UTC (rev 159349)
@@ -4473,6 +4473,9 @@
<ClCompile Include="..\bindings\js\JSSQLTransactionSyncCustom.cpp">
<Filter>bindings\js</Filter>
</ClCompile>
+ <ClCompile Include="..\bindings\js\JSRTCIceCandidateCustom.cpp">
+ <Filter>bindings\js</Filter>
+ </ClCompile>
<ClCompile Include="..\bindings\js\JSRTCPeerConnectionCustom.cpp">
<Filter>bindings\js</Filter>
</ClCompile>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (159348 => 159349)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-11-15 19:30:57 UTC (rev 159348)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-11-15 19:34:16 UTC (rev 159349)
@@ -1567,6 +1567,7 @@
4AD01009127E642A0015035F /* HTMLOutputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD01006127E642A0015035F /* HTMLOutputElement.h */; };
4AD0173C127E82860015035F /* JSHTMLOutputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AD0173A127E82860015035F /* JSHTMLOutputElement.cpp */; };
4AD0173D127E82860015035F /* JSHTMLOutputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AD0173B127E82860015035F /* JSHTMLOutputElement.h */; };
+ 4AE0BF891836084400F3852D /* JSRTCIceCandidateCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AE0BF881836083100F3852D /* JSRTCIceCandidateCustom.cpp */; };
4B2708C70AF19EE40065127F /* Pasteboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B2708C50AF19EE40065127F /* Pasteboard.h */; settings = {ATTRIBUTES = (Private, ); }; };
4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B2709810AF2E5E00065127F /* PasteboardMac.mm */; };
4B3043C70AE0370300A82647 /* Sound.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3043C60AE0370300A82647 /* Sound.h */; };
@@ -8259,6 +8260,7 @@
4AD01007127E642A0015035F /* HTMLOutputElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLOutputElement.idl; sourceTree = "<group>"; };
4AD0173A127E82860015035F /* JSHTMLOutputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOutputElement.cpp; sourceTree = "<group>"; };
4AD0173B127E82860015035F /* JSHTMLOutputElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLOutputElement.h; sourceTree = "<group>"; };
+ 4AE0BF881836083100F3852D /* JSRTCIceCandidateCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCIceCandidateCustom.cpp; sourceTree = "<group>"; };
4B2708C50AF19EE40065127F /* Pasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pasteboard.h; sourceTree = "<group>"; };
4B2709810AF2E5E00065127F /* PasteboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PasteboardMac.mm; sourceTree = "<group>"; };
4B3043C60AE0370300A82647 /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = "<group>"; };
@@ -19612,6 +19614,7 @@
BC4EDEF70C08F414007EDD49 /* Custom */ = {
isa = PBXGroup;
children = (
+ 4AE0BF881836083100F3852D /* JSRTCIceCandidateCustom.cpp */,
07D07B131834158800ABDD3C /* JSRTCSessionDescriptionCustom.cpp */,
0705851617FB40E9005F2BCB /* JSMediaStreamCapabilitiesCustom.cpp */,
07C59B6D17F794F6000FBCBB /* JSMediaSourceStatesCustom.cpp */,
@@ -25874,6 +25877,7 @@
4A4F48A916B0DFC000EDBB29 /* DocumentRuleSets.cpp in Sources */,
AD6E71AC1668899D00320C13 /* DocumentSharedObjectPool.cpp in Sources */,
2D46F04E17B96FBD005647F0 /* IntPoint.cpp in Sources */,
+ 4AE0BF891836084400F3852D /* JSRTCIceCandidateCustom.cpp in Sources */,
E47E276816036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp in Sources */,
0B9056190F2578BE0095FF6A /* DocumentThreadableLoader.cpp in Sources */,
073BE34E17D180B2002BD431 /* RTCSessionDescriptionDescriptor.cpp in Sources */,
Added: trunk/Source/WebCore/bindings/js/JSRTCIceCandidateCustom.cpp (0 => 159349)
--- trunk/Source/WebCore/bindings/js/JSRTCIceCandidateCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSRTCIceCandidateCustom.cpp 2013-11-15 19:34:16 UTC (rev 159349)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "JSRTCIceCandidate.h"
+
+#include "Dictionary.h"
+#include "ExceptionCode.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+EncodedJSValue JSC_HOST_CALL JSRTCIceCandidateConstructor::constructJSRTCIceCandidate(ExecState* exec)
+{
+ ExceptionCode ec = 0;
+ Dictionary sessionInit;
+ if (exec->argumentCount() > 0) {
+ sessionInit = Dictionary(exec, exec->argument(0));
+ if (!sessionInit.isObject())
+ return throwVMError(exec, createTypeError(exec, "Optional RTCIceCandidate constructor argument must be a valid Dictionary"));
+
+ if (exec->hadException())
+ return JSValue::encode(jsUndefined());
+ }
+
+ JSRTCIceCandidateConstructor* jsConstructor = jsCast<JSRTCIceCandidateConstructor*>(exec->callee());
+ RefPtr<RTCIceCandidate> iceCandidate = RTCIceCandidate::create(sessionInit, ec);
+ if (ec == TYPE_MISMATCH_ERR) {
+ setDOMException(exec, ec);
+ return throwVMError(exec, createTypeError(exec, "Invalid RTCIceCandidate constructor arguments"));
+ }
+
+ if (ec) {
+ setDOMException(exec, ec);
+ return throwVMError(exec, createTypeError(exec, "Error creating RTCIceCandidate"));
+ }
+
+ return JSValue::encode(CREATE_DOM_WRAPPER(exec, jsConstructor->globalObject(), RTCIceCandidate, iceCandidate.get()));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+