Diff
Modified: trunk/LayoutTests/ChangeLog (118585 => 118586)
--- trunk/LayoutTests/ChangeLog 2012-05-25 23:29:45 UTC (rev 118585)
+++ trunk/LayoutTests/ChangeLog 2012-05-25 23:31:39 UTC (rev 118586)
@@ -1,3 +1,13 @@
+2012-05-25 Tommy Widenflycht <tom...@google.com>
+
+ MediaStream API: Make sure IceCallback is valid for PeerConnection00
+ https://bugs.webkit.org/show_bug.cgi?id=87480
+
+ Reviewed by Adam Barth.
+
+ * fast/mediastream/constructors-expected.txt:
+ * fast/mediastream/constructors.html:
+
2012-05-25 Mike West <mk...@chromium.org>
Inline script and style blocked by Content Security Policy should provide more detailed console errors.
Modified: trunk/LayoutTests/fast/mediastream/constructors-expected.txt (118585 => 118586)
--- trunk/LayoutTests/fast/mediastream/constructors-expected.txt 2012-05-25 23:29:45 UTC (rev 118585)
+++ trunk/LayoutTests/fast/mediastream/constructors-expected.txt 2012-05-25 23:31:39 UTC (rev 118586)
@@ -7,6 +7,10 @@
PASS typeof SessionDescription === 'function' is true
PASS typeof IceCandidate === 'function' is true
PASS new webkitPeerConnection00('STUN foobar.com:12345', function(){}); did not throw exception.
+PASS new webkitPeerConnection00('STUN foobar.com:12345'); threw exception TypeError: Not enough arguments.
+PASS new webkitPeerConnection00('STUN foobar.com:12345', null); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS new webkitPeerConnection00('STUN foobar.com:12345', undefined); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS new webkitPeerConnection00('STUN foobar.com:12345', 'STUN'); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
PASS new SessionDescription(''); did not throw exception.
PASS new IceCandidate('', ''); did not throw exception.
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/mediastream/constructors.html (118585 => 118586)
--- trunk/LayoutTests/fast/mediastream/constructors.html 2012-05-25 23:29:45 UTC (rev 118585)
+++ trunk/LayoutTests/fast/mediastream/constructors.html 2012-05-25 23:31:39 UTC (rev 118586)
@@ -10,21 +10,16 @@
<script>
description("Tests the JSEP PeerConnection related constructors.");
-function shouldNotThrow(_expression_)
-{
- try {
- eval(_expression_);
- testPassed(_expression_ + " did not throw exception.");
- } catch(e) {
- testFailed(_expression_ + " should not throw exception. Threw exception " + e);
- }
-}
-
shouldBeTrue("typeof webkitPeerConnection00 === 'function'");
shouldBeTrue("typeof SessionDescription === 'function'");
shouldBeTrue("typeof IceCandidate === 'function'");
shouldNotThrow("new webkitPeerConnection00('STUN foobar.com:12345', function(){});");
+shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345');");
+shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345', null);");
+shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345', undefined);");
+shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345', 'STUN');");
+
shouldNotThrow("new SessionDescription('');");
shouldNotThrow("new IceCandidate('', '');");
Modified: trunk/Source/WebCore/ChangeLog (118585 => 118586)
--- trunk/Source/WebCore/ChangeLog 2012-05-25 23:29:45 UTC (rev 118585)
+++ trunk/Source/WebCore/ChangeLog 2012-05-25 23:31:39 UTC (rev 118586)
@@ -1,3 +1,17 @@
+2012-05-25 Tommy Widenflycht <tom...@google.com>
+
+ MediaStream API: Make sure IceCallback is valid for PeerConnection00
+ https://bugs.webkit.org/show_bug.cgi?id=87480
+
+ Reviewed by Adam Barth.
+
+ Existing tests have been extended to cover this change.
+
+ * Modules/mediastream/PeerConnection00.cpp:
+ (WebCore::PeerConnection00::create):
+ * Modules/mediastream/PeerConnection00.h:
+ * Modules/mediastream/PeerConnection00.idl:
+
2012-05-25 Mike West <mk...@chromium.org>
Inline script and style blocked by Content Security Policy should provide more detailed console errors.
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnection00.cpp (118585 => 118586)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnection00.cpp 2012-05-25 23:29:45 UTC (rev 118585)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnection00.cpp 2012-05-25 23:31:39 UTC (rev 118586)
@@ -49,8 +49,12 @@
namespace WebCore {
-PassRefPtr<PeerConnection00> PeerConnection00::create(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<IceCallback> iceCallback)
+PassRefPtr<PeerConnection00> PeerConnection00::create(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<IceCallback> iceCallback, ExceptionCode& ec)
{
+ if (!iceCallback) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
RefPtr<PeerConnection00> peerConnection = adoptRef(new PeerConnection00(context, serverConfiguration, iceCallback));
peerConnection->suspendIfNeeded();
return peerConnection.release();
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnection00.h (118585 => 118586)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnection00.h 2012-05-25 23:29:45 UTC (rev 118585)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnection00.h 2012-05-25 23:31:39 UTC (rev 118586)
@@ -86,7 +86,7 @@
ICE_CLOSED = 0x700
};
- static PassRefPtr<PeerConnection00> create(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<IceCallback>);
+ static PassRefPtr<PeerConnection00> create(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<IceCallback>, ExceptionCode&);
~PeerConnection00();
PassRefPtr<SessionDescription> createOffer(ExceptionCode&);
Modified: trunk/Source/WebCore/Modules/mediastream/PeerConnection00.idl (118585 => 118586)
--- trunk/Source/WebCore/Modules/mediastream/PeerConnection00.idl 2012-05-25 23:29:45 UTC (rev 118585)
+++ trunk/Source/WebCore/Modules/mediastream/PeerConnection00.idl 2012-05-25 23:31:39 UTC (rev 118586)
@@ -35,6 +35,7 @@
ActiveDOMObject,
Constructor(in DOMString serverConfiguration, in [Callback] IceCallback iceCallback),
CallWith=ScriptExecutionContext,
+ ConstructorRaisesException,
EventTarget
] PeerConnection00 {
SessionDescription createOffer(in [Optional] Dictionary mediaHints)