Changeset 185820 in webkit


Ignore:
Timestamp:
Jun 22, 2015 1:36:38 AM (9 years ago)
Author:
adam.bergkvist@ericsson.com
Message:

WebRTC: Navigator.webkitGetUserMedia() requires three arguments
https://bugs.webkit.org/show_bug.cgi?id=146022

Reviewed by Eric Carlson.

Source/WebCore:

Updated custom binding to make the third error callback argument
mandatory. Updated and unskipped three tests (for the GTK+ port).

  • bindings/js/JSNavigatorCustom.cpp:

(WebCore::JSNavigator::webkitGetUserMedia):

LayoutTests:

Updated and unskipped three existing tests.

  • fast/mediastream/argument-types-expected.txt:
  • fast/mediastream/getusermedia-expected.txt:
  • fast/mediastream/getusermedia.html:
  • fast/mediastream/script-tests/argument-types.js:
  • platform/gtk/TestExpectations:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185815 r185820  
     12015-06-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Navigator.webkitGetUserMedia() requires three arguments
     4        https://bugs.webkit.org/show_bug.cgi?id=146022
     5
     6        Reviewed by Eric Carlson.
     7
     8        Updated and unskipped three existing tests.
     9
     10        * fast/mediastream/argument-types-expected.txt:
     11        * fast/mediastream/getusermedia-expected.txt:
     12        * fast/mediastream/getusermedia.html:
     13        * fast/mediastream/script-tests/argument-types.js:
     14        * platform/gtk/TestExpectations:
     15
    1162015-06-21  David Kilzer  <ddkilzer@apple.com>
    217
  • trunk/LayoutTests/fast/mediastream/argument-types-expected.txt

    r165915 r185820  
    1414PASS navigator.webkitGetUserMedia(-Infinity) threw exception TypeError: Not enough arguments.
    1515PASS navigator.webkitGetUserMedia(emptyFunction) threw exception TypeError: Not enough arguments.
    16 PASS navigator.webkitGetUserMedia({video: true}, emptyFunction) did not throw exception.
    17 PASS navigator.webkitGetUserMedia(undefined, emptyFunction) threw exception TypeError: First argument of webkitGetUserMedia must be a valid Dictionary.
    18 PASS navigator.webkitGetUserMedia(null, emptyFunction) threw exception TypeError: First argument of webkitGetUserMedia must be a valid Dictionary.
    19 PASS navigator.webkitGetUserMedia({ }, emptyFunction) threw exception Error: NotSupportedError: DOM Exception 9.
    20 PASS navigator.webkitGetUserMedia(true, emptyFunction) threw exception TypeError: First argument of webkitGetUserMedia must be a valid Dictionary.
    21 PASS navigator.webkitGetUserMedia(42, emptyFunction) threw exception TypeError: First argument of webkitGetUserMedia must be a valid Dictionary.
    22 PASS navigator.webkitGetUserMedia(Infinity, emptyFunction) threw exception TypeError: First argument of webkitGetUserMedia must be a valid Dictionary.
    23 PASS navigator.webkitGetUserMedia(-Infinity, emptyFunction) threw exception TypeError: First argument of webkitGetUserMedia must be a valid Dictionary.
    24 PASS navigator.webkitGetUserMedia(emptyFunction, emptyFunction) threw exception Error: NotSupportedError: DOM Exception 9.
    25 PASS navigator.webkitGetUserMedia({video: true}, "foobar") threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
    26 PASS navigator.webkitGetUserMedia({video: true}, undefined) threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
    27 PASS navigator.webkitGetUserMedia({video: true}, null) threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
    28 PASS navigator.webkitGetUserMedia({video: true}, {}) threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
    29 PASS navigator.webkitGetUserMedia({video: true}, true) threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
    30 PASS navigator.webkitGetUserMedia({video: true}, 42) threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
    31 PASS navigator.webkitGetUserMedia({video: true}, Infinity) threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
    32 PASS navigator.webkitGetUserMedia({video: true}, -Infinity) threw exception TypeError: Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function.
     16PASS navigator.webkitGetUserMedia({video: true}, emptyFunction) threw exception TypeError: Not enough arguments.
     17PASS navigator.webkitGetUserMedia(undefined, emptyFunction) threw exception TypeError: Not enough arguments.
     18PASS navigator.webkitGetUserMedia(null, emptyFunction) threw exception TypeError: Not enough arguments.
     19PASS navigator.webkitGetUserMedia({ }, emptyFunction) threw exception TypeError: Not enough arguments.
     20PASS navigator.webkitGetUserMedia(true, emptyFunction) threw exception TypeError: Not enough arguments.
     21PASS navigator.webkitGetUserMedia(42, emptyFunction) threw exception TypeError: Not enough arguments.
     22PASS navigator.webkitGetUserMedia(Infinity, emptyFunction) threw exception TypeError: Not enough arguments.
     23PASS navigator.webkitGetUserMedia(-Infinity, emptyFunction) threw exception TypeError: Not enough arguments.
     24PASS navigator.webkitGetUserMedia(emptyFunction, emptyFunction) threw exception TypeError: Not enough arguments.
     25PASS navigator.webkitGetUserMedia({video: true}, "foobar") threw exception TypeError: Not enough arguments.
     26PASS navigator.webkitGetUserMedia({video: true}, undefined) threw exception TypeError: Not enough arguments.
     27PASS navigator.webkitGetUserMedia({video: true}, null) threw exception TypeError: Not enough arguments.
     28PASS navigator.webkitGetUserMedia({video: true}, {}) threw exception TypeError: Not enough arguments.
     29PASS navigator.webkitGetUserMedia({video: true}, true) threw exception TypeError: Not enough arguments.
     30PASS navigator.webkitGetUserMedia({video: true}, 42) threw exception TypeError: Not enough arguments.
     31PASS navigator.webkitGetUserMedia({video: true}, Infinity) threw exception TypeError: Not enough arguments.
     32PASS navigator.webkitGetUserMedia({video: true}, -Infinity) threw exception TypeError: Not enough arguments.
    3333PASS navigator.webkitGetUserMedia({ }, emptyFunction, emptyFunction) threw exception Error: NotSupportedError: DOM Exception 9.
    3434PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, emptyFunction) did not throw exception.
    35 PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined) did not throw exception.
    36 PASS navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined) did not throw exception.
    37 PASS navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined) did not throw exception.
     35PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined) threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
     36PASS navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined) threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
     37PASS navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined) threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    3838PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, "video") threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    39 PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, null) did not throw exception.
     39PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, null) threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    4040PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, {}) threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    4141PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, true) threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
  • trunk/LayoutTests/fast/mediastream/getusermedia-expected.txt

    r156108 r185820  
    55
    66PASS navigator.webkitGetUserMedia({audio:false, video:false}, error, error); threw exception Error: NotSupportedError: DOM Exception 9.
     7PASS navigator.webkitGetUserMedia({audio:false, video:false}, error, null); threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    78PASS navigator.webkitGetUserMedia({audio:true}, gotStream1, error); did not throw exception.
    89PASS Stream generated.
    910PASS stream.getAudioTracks().length is 1
    1011PASS stream.getVideoTracks().length is 0
     12PASS navigator.webkitGetUserMedia({video:true}, gotStream2, null); threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    1113PASS navigator.webkitGetUserMedia({video:true}, gotStream2, error); did not throw exception.
    1214PASS Stream generated.
    1315PASS stream.getAudioTracks().length is 0
    1416PASS stream.getVideoTracks().length is 1
     17PASS navigator.webkitGetUserMedia({audio:true, video:true}, gotStream3, null); threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    1518PASS navigator.webkitGetUserMedia({audio:true, video:true}, gotStream3, error); did not throw exception.
    1619PASS Stream generated.
    1720PASS stream.getAudioTracks().length is 1
    1821PASS stream.getVideoTracks().length is 1
     22PASS navigator.webkitGetUserMedia({audio:{mandatory:{}, optional:[]}, video:true}, gotStream4, null); threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    1923PASS navigator.webkitGetUserMedia({audio:{mandatory:{}, optional:[]}, video:true}, gotStream4, error); did not throw exception.
    2024PASS Stream generated.
    2125PASS stream.getAudioTracks().length is 1
    2226PASS stream.getVideoTracks().length is 1
     27PASS navigator.webkitGetUserMedia({audio:{mandatory:{'valid_but_unsupported_1':0}, optional:[]}, video:true}, gotStreamInError, null); threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    2328PASS navigator.webkitGetUserMedia({audio:{mandatory:{'valid_but_unsupported_1':0}, optional:[]}, video:true}, gotStreamInError, error1); did not throw exception.
    2429PASS Error callback called.
    2530PASS errorArg.name is "ConstraintNotSatisfiedError"
    2631PASS errorArg.constraintName is "valid_but_unsupported_1"
     32PASS navigator.webkitGetUserMedia({audio:{mandatory:{'valid_and_supported_1':1}, optional:[{'valid_but_unsupported_1':0}]}, video:true}, gotStream5, 0); threw exception TypeError: Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function.
    2733PASS navigator.webkitGetUserMedia({audio:{mandatory:{'valid_and_supported_1':1}, optional:[{'valid_but_unsupported_1':0}]}, video:true}, gotStream5, error); did not throw exception.
    2834PASS Stream generated.
  • trunk/LayoutTests/fast/mediastream/getusermedia.html

    r168842 r185820  
    99        <script>
    1010            description("Tests webkitGetUserMedia.");
     11
     12            function setUserMediaPermission(isGranted) {
     13                if (window.testRunner)
     14                    testRunner.setUserMediaPermission(isGranted);
     15                else
     16                    debug("This test can not be run without the testRunner");
     17            }
    1118
    1219            var stream;
     
    8390            shouldThrow("navigator.webkitGetUserMedia({audio:false, video:false}, error, error);")
    8491            shouldThrow("navigator.webkitGetUserMedia({audio:false, video:false}, error, null);")
     92
     93            setUserMediaPermission(true);
    8594            shouldNotThrow("navigator.webkitGetUserMedia({audio:true}, gotStream1, error);");
    8695
  • trunk/LayoutTests/fast/mediastream/script-tests/argument-types.js

    r165915 r185820  
    2424test('navigator.webkitGetUserMedia()', true);
    2525
    26 // 1 Argument (getUserMedia requires at least 2 arguments).
     26// 1 Argument (Navigtor.webkitGetUserMedia requires at least 3 arguments).
    2727test('navigator.webkitGetUserMedia(undefined)', true);
    2828test('navigator.webkitGetUserMedia(null)', true);
     
    3636
    3737// 2 Arguments.
    38 test('navigator.webkitGetUserMedia({video: true}, emptyFunction)', false);
    39 test('navigator.webkitGetUserMedia(undefined, emptyFunction)', true, invalidDictionaryError);
    40 test('navigator.webkitGetUserMedia(null, emptyFunction)', true, invalidDictionaryError);
    41 test('navigator.webkitGetUserMedia({ }, emptyFunction)', true, notSupportedError);
    42 test('navigator.webkitGetUserMedia(true, emptyFunction)', true, invalidDictionaryError);
    43 test('navigator.webkitGetUserMedia(42, emptyFunction)', true, invalidDictionaryError);
    44 test('navigator.webkitGetUserMedia(Infinity, emptyFunction)', true, invalidDictionaryError);
    45 test('navigator.webkitGetUserMedia(-Infinity, emptyFunction)', true, invalidDictionaryError);
    46 test('navigator.webkitGetUserMedia(emptyFunction, emptyFunction)', true, notSupportedError);
    47 test('navigator.webkitGetUserMedia({video: true}, "foobar")', true, successCallbackError);
    48 test('navigator.webkitGetUserMedia({video: true}, undefined)', true, successCallbackError);
    49 test('navigator.webkitGetUserMedia({video: true}, null)', true, successCallbackError);
    50 test('navigator.webkitGetUserMedia({video: true}, {})', true, successCallbackError);
    51 test('navigator.webkitGetUserMedia({video: true}, true)', true, successCallbackError);
    52 test('navigator.webkitGetUserMedia({video: true}, 42)', true, successCallbackError);
    53 test('navigator.webkitGetUserMedia({video: true}, Infinity)', true, successCallbackError);
    54 test('navigator.webkitGetUserMedia({video: true}, -Infinity)', true, successCallbackError);
     38test('navigator.webkitGetUserMedia({video: true}, emptyFunction)', true);
     39test('navigator.webkitGetUserMedia(undefined, emptyFunction)', true);
     40test('navigator.webkitGetUserMedia(null, emptyFunction)', true);
     41test('navigator.webkitGetUserMedia({ }, emptyFunction)', true);
     42test('navigator.webkitGetUserMedia(true, emptyFunction)', true);
     43test('navigator.webkitGetUserMedia(42, emptyFunction)', true);
     44test('navigator.webkitGetUserMedia(Infinity, emptyFunction)', true);
     45test('navigator.webkitGetUserMedia(-Infinity, emptyFunction)', true);
     46test('navigator.webkitGetUserMedia(emptyFunction, emptyFunction)', true);
     47test('navigator.webkitGetUserMedia({video: true}, "foobar")', true);
     48test('navigator.webkitGetUserMedia({video: true}, undefined)', true);
     49test('navigator.webkitGetUserMedia({video: true}, null)', true);
     50test('navigator.webkitGetUserMedia({video: true}, {})', true);
     51test('navigator.webkitGetUserMedia({video: true}, true)', true);
     52test('navigator.webkitGetUserMedia({video: true}, 42)', true);
     53test('navigator.webkitGetUserMedia({video: true}, Infinity)', true);
     54test('navigator.webkitGetUserMedia({video: true}, -Infinity)', true);
    5555
    5656// 3 Arguments.
    5757test('navigator.webkitGetUserMedia({ }, emptyFunction, emptyFunction)', true, notSupportedError);
    5858test('navigator.webkitGetUserMedia({video: true}, emptyFunction, emptyFunction)', false);
    59 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined)', false);
    60 test('navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined)', false);
    61 test('navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined)', false);
     59test('navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined)', true, errorCallbackError);
     60test('navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined)', true, errorCallbackError);
     61test('navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined)', true, errorCallbackError);
    6262test('navigator.webkitGetUserMedia({video: true}, emptyFunction, "video")', true, errorCallbackError);
    63 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, null)', false );
     63test('navigator.webkitGetUserMedia({video: true}, emptyFunction, null)', true, errorCallbackError );
    6464test('navigator.webkitGetUserMedia({video: true}, emptyFunction, {})', true, errorCallbackError);
    6565test('navigator.webkitGetUserMedia({video: true}, emptyFunction, true)', true, errorCallbackError);
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r185402 r185820  
    315315
    316316# Mediastream implementation is not complete yet.
    317 webkit.org/b/79203 fast/mediastream/argument-types.html [ Skip ]
    318 webkit.org/b/79203 fast/mediastream/getusermedia.html [ Skip ]
    319317webkit.org/b/79203 fast/mediastream/MediaStream-add-ended-tracks.html [ Skip ]
    320318webkit.org/b/79203 fast/mediastream/MediaStream-add-remove-tracks.html [ Skip ]
     
    329327webkit.org/b/79203 fast/mediastream/MediaStreamTrack.html [ Skip ]
    330328webkit.org/b/79203 fast/mediastream/MediaStreamTrack-onended.html [ Skip ]
    331 webkit.org/b/79203 fast/mediastream/no-interface-object.html [ Skip ]
    332329webkit.org/b/79203 fast/mediastream/RTCIceCandidate.html [ Skip ]
    333330webkit.org/b/79203 fast/mediastream/RTCPeerConnection-AddRemoveStream.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r185819 r185820  
     12015-06-22  Adam Bergkvist  <adam.bergkvist@ericsson.com>
     2
     3        WebRTC: Navigator.webkitGetUserMedia() requires three arguments
     4        https://bugs.webkit.org/show_bug.cgi?id=146022
     5
     6        Reviewed by Eric Carlson.
     7
     8        Updated custom binding to make the third error callback argument
     9        mandatory. Updated and unskipped three tests (for the GTK+ port).
     10
     11        * bindings/js/JSNavigatorCustom.cpp:
     12        (WebCore::JSNavigator::webkitGetUserMedia):
     13
    1142015-06-22  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp

    r168576 r185820  
    4141JSValue JSNavigator::webkitGetUserMedia(ExecState* exec)
    4242{
    43     if (exec->argumentCount() < 2) {
     43    if (exec->argumentCount() < 3) {
    4444        throwVMError(exec, createNotEnoughArgumentsError(exec));
    4545        return jsUndefined();
     
    6060    }
    6161
    62     JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(exec->thisValue());
    63     RefPtr<NavigatorUserMediaErrorCallback> errorCallback;
    64     if (!exec->argument(2).isUndefinedOrNull()) {
    65         if (!exec->uncheckedArgument(2).isFunction()) {
    66             throwVMTypeError(exec, "Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function");
    67             return jsUndefined();
    68         }
    69         errorCallback = JSNavigatorUserMediaErrorCallback::create(asObject(exec->uncheckedArgument(2)), castedThis->globalObject());
     62    if (!exec->argument(2).isFunction()) {
     63        throwVMTypeError(exec, "Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function");
     64        return jsUndefined();
    7065    }
    7166
    72     RefPtr<NavigatorUserMediaSuccessCallback> successCallback = JSNavigatorUserMediaSuccessCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
    73     Navigator& impl = castedThis->impl();
     67    RefPtr<NavigatorUserMediaSuccessCallback> successCallback = JSNavigatorUserMediaSuccessCallback::create(asObject(exec->uncheckedArgument(1)), globalObject());
     68    RefPtr<NavigatorUserMediaErrorCallback> errorCallback = JSNavigatorUserMediaErrorCallback::create(asObject(exec->uncheckedArgument(2)), globalObject());
     69
    7470    ExceptionCode ec = 0;
    75     NavigatorUserMedia::webkitGetUserMedia(&impl, options, successCallback, errorCallback, ec);
     71    NavigatorUserMedia::webkitGetUserMedia(&impl(), options, successCallback, errorCallback, ec);
    7672    setDOMException(exec, ec);
    7773    return jsUndefined();
Note: See TracChangeset for help on using the changeset viewer.