Changeset 118586 in webkit


Ignore:
Timestamp:
May 25, 2012 4:31:39 PM (12 years ago)
Author:
tommyw@google.com
Message:

MediaStream API: Make sure IceCallback is valid for PeerConnection00
https://bugs.webkit.org/show_bug.cgi?id=87480

Reviewed by Adam Barth.

Source/WebCore:

Existing tests have been extended to cover this change.

  • Modules/mediastream/PeerConnection00.cpp:

(WebCore::PeerConnection00::create):

  • Modules/mediastream/PeerConnection00.h:
  • Modules/mediastream/PeerConnection00.idl:

LayoutTests:

  • fast/mediastream/constructors-expected.txt:
  • fast/mediastream/constructors.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r118585 r118586  
     12012-05-25  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API: Make sure IceCallback is valid for PeerConnection00
     4        https://bugs.webkit.org/show_bug.cgi?id=87480
     5
     6        Reviewed by Adam Barth.
     7
     8        * fast/mediastream/constructors-expected.txt:
     9        * fast/mediastream/constructors.html:
     10
    1112012-05-25  Mike West  <mkwst@chromium.org>
    212
  • trunk/LayoutTests/fast/mediastream/constructors-expected.txt

    r115651 r118586  
    88PASS typeof IceCandidate === 'function' is true
    99PASS new webkitPeerConnection00('STUN foobar.com:12345', function(){}); did not throw exception.
     10PASS new webkitPeerConnection00('STUN foobar.com:12345'); threw exception TypeError: Not enough arguments.
     11PASS new webkitPeerConnection00('STUN foobar.com:12345', null); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     12PASS new webkitPeerConnection00('STUN foobar.com:12345', undefined); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     13PASS new webkitPeerConnection00('STUN foobar.com:12345', 'STUN'); threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    1014PASS new SessionDescription(''); did not throw exception.
    1115PASS new IceCandidate('', ''); did not throw exception.
  • trunk/LayoutTests/fast/mediastream/constructors.html

    r115651 r118586  
    1111description("Tests the JSEP PeerConnection related constructors.");
    1212
    13 function shouldNotThrow(expression)
    14 {
    15   try {
    16     eval(expression);
    17     testPassed(expression + " did not throw exception.");
    18   } catch(e) {
    19     testFailed(expression + " should not throw exception. Threw exception " + e);
    20   }
    21 }
    22 
    2313shouldBeTrue("typeof webkitPeerConnection00 === 'function'");
    2414shouldBeTrue("typeof SessionDescription === 'function'");
     
    2616
    2717shouldNotThrow("new webkitPeerConnection00('STUN foobar.com:12345', function(){});");
     18shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345');");
     19shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345', null);");
     20shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345', undefined);");
     21shouldThrow("new webkitPeerConnection00('STUN foobar.com:12345', 'STUN');");
     22
    2823shouldNotThrow("new SessionDescription('');");
    2924shouldNotThrow("new IceCandidate('', '');");
  • trunk/Source/WebCore/ChangeLog

    r118585 r118586  
     12012-05-25  Tommy Widenflycht  <tommyw@google.com>
     2
     3        MediaStream API: Make sure IceCallback is valid for PeerConnection00
     4        https://bugs.webkit.org/show_bug.cgi?id=87480
     5
     6        Reviewed by Adam Barth.
     7
     8        Existing tests have been extended to cover this change.
     9
     10        * Modules/mediastream/PeerConnection00.cpp:
     11        (WebCore::PeerConnection00::create):
     12        * Modules/mediastream/PeerConnection00.h:
     13        * Modules/mediastream/PeerConnection00.idl:
     14
    1152012-05-25  Mike West  <mkwst@chromium.org>
    216
  • trunk/Source/WebCore/Modules/mediastream/PeerConnection00.cpp

    r116675 r118586  
    5050namespace WebCore {
    5151
    52 PassRefPtr<PeerConnection00> PeerConnection00::create(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<IceCallback> iceCallback)
    53 {
     52PassRefPtr<PeerConnection00> PeerConnection00::create(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<IceCallback> iceCallback, ExceptionCode& ec)
     53{
     54    if (!iceCallback) {
     55        ec = TYPE_MISMATCH_ERR;
     56        return 0;
     57    }
    5458    RefPtr<PeerConnection00> peerConnection = adoptRef(new PeerConnection00(context, serverConfiguration, iceCallback));
    5559    peerConnection->suspendIfNeeded();
  • trunk/Source/WebCore/Modules/mediastream/PeerConnection00.h

    r116127 r118586  
    8787    };
    8888
    89     static PassRefPtr<PeerConnection00> create(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<IceCallback>);
     89    static PassRefPtr<PeerConnection00> create(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<IceCallback>, ExceptionCode&);
    9090    ~PeerConnection00();
    9191
  • trunk/Source/WebCore/Modules/mediastream/PeerConnection00.idl

    r116127 r118586  
    3636        Constructor(in DOMString serverConfiguration, in [Callback] IceCallback iceCallback),
    3737        CallWith=ScriptExecutionContext,
     38        ConstructorRaisesException,
    3839        EventTarget
    3940    ] PeerConnection00 {
Note: See TracChangeset for help on using the changeset viewer.