Changeset 86055 in webkit


Ignore:
Timestamp:
May 9, 2011 7:58:13 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-09 Leandro Gracia Gil <leandrogracia@chromium.org>

Reviewed by Tony Gentilcore.

Media Stream API: add exception raising to the getUserMedia method.
https://bugs.webkit.org/show_bug.cgi?id=60387

Update the expected results for the argument types after the lastest updates
in the getUserMedia specification. The test has been disabled temporarily
and will be re-enabled by 60177 since some exceptions are risen after parsing
the provided options.

  • fast/dom/MediaStream/argument-types-expected.txt:
  • fast/dom/MediaStream/script-tests/argument-types.js: (ObjectThrowingException.prototype.toString):
  • platform/chromium/test_expectations.txt:

2011-05-09 Leandro Gracia Gil <leandrogracia@chromium.org>

Reviewed by Tony Gentilcore.

Media Stream API: add exception raising to the getUserMedia method.
https://bugs.webkit.org/show_bug.cgi?id=60387

Perform the required changes to support rising exceptions in the
navigator.getUserMedia method. This is required by the latest changes in the spec:
http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-navigator-getusermedia

Test: fast/dom/MediaStream/argument-types.html

  • bindings/js/JSNavigatorCustom.cpp: (WebCore::JSNavigator::webkitGetUserMedia):
  • bindings/v8/custom/V8NavigatorCustom.cpp: (WebCore::V8Navigator::webkitGetUserMediaCallback):
  • page/Navigator.cpp: (WebCore::Navigator::webkitGetUserMedia):
  • page/Navigator.h:
  • page/Navigator.idl:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86053 r86055  
     12011-05-09  Leandro Gracia Gil  <leandrogracia@chromium.org>
     2
     3        Reviewed by Tony Gentilcore.
     4
     5        Media Stream API: add exception raising to the getUserMedia method.
     6        https://bugs.webkit.org/show_bug.cgi?id=60387
     7
     8        Update the expected results for the argument types after the lastest updates
     9        in the getUserMedia specification. The test has been disabled temporarily
     10        and will be re-enabled by 60177 since some exceptions are risen after parsing
     11        the provided options.
     12
     13        * fast/dom/MediaStream/argument-types-expected.txt:
     14        * fast/dom/MediaStream/script-tests/argument-types.js:
     15        (ObjectThrowingException.prototype.toString):
     16        * platform/chromium/test_expectations.txt:
     17
    1182011-05-09  Andreas Kling  <andreas.kling@nokia.com>
    219
  • trunk/LayoutTests/fast/dom/MediaStream/argument-types-expected.txt

    r83287 r86055  
    88PASS navigator.webkitGetUserMedia(null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    99PASS navigator.webkitGetUserMedia({}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    10 PASS navigator.webkitGetUserMedia(objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     10PASS navigator.webkitGetUserMedia(objectThrowingException) threw exception Error: toString threw exception.
    1111PASS navigator.webkitGetUserMedia("video") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    1212PASS navigator.webkitGetUserMedia(true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     
    1616PASS navigator.webkitGetUserMedia(emptyFunction) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    1717PASS navigator.webkitGetUserMedia("video", emptyFunction) did not throw exception.
    18 PASS navigator.webkitGetUserMedia(undefined, emptyFunction) did not throw exception.
    19 PASS navigator.webkitGetUserMedia(null, emptyFunction) did not throw exception.
    20 PASS navigator.webkitGetUserMedia({}, emptyFunction) did not throw exception.
     18PASS navigator.webkitGetUserMedia(undefined, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
     19PASS navigator.webkitGetUserMedia(null, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
     20PASS navigator.webkitGetUserMedia({}, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
    2121PASS navigator.webkitGetUserMedia(objectThrowingException, emptyFunction) threw exception Error: toString threw exception.
    22 PASS navigator.webkitGetUserMedia(true, emptyFunction) did not throw exception.
    23 PASS navigator.webkitGetUserMedia(42, emptyFunction) did not throw exception.
    24 PASS navigator.webkitGetUserMedia(Infinity, emptyFunction) did not throw exception.
    25 PASS navigator.webkitGetUserMedia(-Infinity, emptyFunction) did not throw exception.
    26 PASS navigator.webkitGetUserMedia(emptyFunction, emptyFunction) did not throw exception.
     22PASS navigator.webkitGetUserMedia(true, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
     23PASS navigator.webkitGetUserMedia(42, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
     24PASS navigator.webkitGetUserMedia(Infinity, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
     25PASS navigator.webkitGetUserMedia(-Infinity, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
     26PASS navigator.webkitGetUserMedia(emptyFunction, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
    2727PASS navigator.webkitGetUserMedia("video", "video") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    2828PASS navigator.webkitGetUserMedia("video", undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
     
    3636PASS navigator.webkitGetUserMedia("video", emptyFunction, emptyFunction) did not throw exception.
    3737PASS navigator.webkitGetUserMedia("video", emptyFunction, undefined) did not throw exception.
     38PASS navigator.webkitGetUserMedia("audio, video", emptyFunction, undefined) did not throw exception.
     39PASS navigator.webkitGetUserMedia("audio, somethingelse,,video", emptyFunction, undefined) did not throw exception.
     40PASS navigator.webkitGetUserMedia("audio, video user", emptyFunction, undefined) did not throw exception.
     41PASS navigator.webkitGetUserMedia("audio, video environment", emptyFunction, undefined) did not throw exception.
    3842PASS navigator.webkitGetUserMedia("video", emptyFunction, "video") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
    3943PASS navigator.webkitGetUserMedia("video", emptyFunction, null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
  • trunk/LayoutTests/fast/dom/MediaStream/script-tests/argument-types.js

    r83287 r86055  
    2222}
    2323
     24var toStringError = new Error('toString threw exception');
     25var notSupportedError = new Error('NOT_SUPPORTED_ERR: DOM Exception 9');
    2426var emptyFunction = function() {};
    2527
    2628function ObjectThrowingException() {};
    27 ObjectThrowingException.prototype.valueOf = function() {
    28     throw new Error('valueOf threw exception');
    29 }
    3029ObjectThrowingException.prototype.toString = function() {
    31     throw new Error('toString threw exception');
     30    throw toStringError;
    3231}
    3332var objectThrowingException = new ObjectThrowingException();
     
    4039test('navigator.webkitGetUserMedia(null)', true);
    4140test('navigator.webkitGetUserMedia({})', true);
    42 test('navigator.webkitGetUserMedia(objectThrowingException)', true);
     41test('navigator.webkitGetUserMedia(objectThrowingException)', true, toStringError);
    4342test('navigator.webkitGetUserMedia("video")', true);
    4443test('navigator.webkitGetUserMedia(true)', true);
     
    5049// 2 Arguments.
    5150test('navigator.webkitGetUserMedia("video", emptyFunction)', false);
    52 test('navigator.webkitGetUserMedia(undefined, emptyFunction)', false);
    53 test('navigator.webkitGetUserMedia(null, emptyFunction)', false);
    54 test('navigator.webkitGetUserMedia({}, emptyFunction)', false);
    55 test('navigator.webkitGetUserMedia(objectThrowingException, emptyFunction)', true, new Error('toString threw exception'));
    56 test('navigator.webkitGetUserMedia(true, emptyFunction)', false);
    57 test('navigator.webkitGetUserMedia(42, emptyFunction)', false);
    58 test('navigator.webkitGetUserMedia(Infinity, emptyFunction)', false);
    59 test('navigator.webkitGetUserMedia(-Infinity, emptyFunction)', false);
    60 test('navigator.webkitGetUserMedia(emptyFunction, emptyFunction)', false);
     51test('navigator.webkitGetUserMedia(undefined, emptyFunction)', true, notSupportedError);
     52test('navigator.webkitGetUserMedia(null, emptyFunction)', true, notSupportedError);
     53test('navigator.webkitGetUserMedia({}, emptyFunction)', true, notSupportedError);
     54test('navigator.webkitGetUserMedia(objectThrowingException, emptyFunction)', true, toStringError);
     55test('navigator.webkitGetUserMedia(true, emptyFunction)', true, notSupportedError);
     56test('navigator.webkitGetUserMedia(42, emptyFunction)', true, notSupportedError);
     57test('navigator.webkitGetUserMedia(Infinity, emptyFunction)', true, notSupportedError);
     58test('navigator.webkitGetUserMedia(-Infinity, emptyFunction)', true, notSupportedError);
     59test('navigator.webkitGetUserMedia(emptyFunction, emptyFunction)', true, notSupportedError);
    6160
    6261test('navigator.webkitGetUserMedia("video", "video")', true);
     
    7372test('navigator.webkitGetUserMedia("video", emptyFunction, emptyFunction)', false);
    7473test('navigator.webkitGetUserMedia("video", emptyFunction, undefined)', false);
     74test('navigator.webkitGetUserMedia("audio, video", emptyFunction, undefined)', false);
     75test('navigator.webkitGetUserMedia("audio, somethingelse,,video", emptyFunction, undefined)', false);
     76test('navigator.webkitGetUserMedia("audio, video user", emptyFunction, undefined)', false);
     77test('navigator.webkitGetUserMedia("audio, video environment", emptyFunction, undefined)', false);
    7578test('navigator.webkitGetUserMedia("video", emptyFunction, "video")', true);
    7679test('navigator.webkitGetUserMedia("video", emptyFunction, null)', true);
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r86047 r86055  
    40464046BUGWK54181 : fast/events/page-visibility-iframe-propagation-test.html = TIMEOUT
    40474047BUGWK54181 : fast/events/page-visibility-transition-test.html = TIMEOUT
     4048
     4049// To be re-enabled after landing https://bugs.webkit.org/show_bug.cgi?id=60177.
     4050BUGWK60387 : fast/dom/MediaStream/argument-types.html = FAIL
  • trunk/Source/WebCore/ChangeLog

    r86054 r86055  
     12011-05-09  Leandro Gracia Gil  <leandrogracia@chromium.org>
     2
     3        Reviewed by Tony Gentilcore.
     4
     5        Media Stream API: add exception raising to the getUserMedia method.
     6        https://bugs.webkit.org/show_bug.cgi?id=60387
     7
     8        Perform the required changes to support rising exceptions in the
     9        navigator.getUserMedia method. This is required by the latest changes in the spec:
     10        http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-navigator-getusermedia
     11
     12        Test: fast/dom/MediaStream/argument-types.html
     13
     14        * bindings/js/JSNavigatorCustom.cpp:
     15        (WebCore::JSNavigator::webkitGetUserMedia):
     16        * bindings/v8/custom/V8NavigatorCustom.cpp:
     17        (WebCore::V8Navigator::webkitGetUserMediaCallback):
     18        * page/Navigator.cpp:
     19        (WebCore::Navigator::webkitGetUserMedia):
     20        * page/Navigator.h:
     21        * page/Navigator.idl:
     22
    1232011-05-09  Csaba Osztrogonác  <ossy@webkit.org>
    224
  • trunk/Source/WebCore/bindings/js/JSNavigatorCustom.cpp

    r84736 r86055  
    2525
    2626#include "CallbackFunction.h"
     27#include "ExceptionCode.h"
    2728#include "JSNavigatorUserMediaErrorCallback.h"
    2829#include "JSNavigatorUserMediaSuccessCallback.h"
     
    5051        return jsUndefined();
    5152
    52     m_impl->webkitGetUserMedia(options, successCallback.release(), errorCallback.release());
     53    ExceptionCode ec;
     54    m_impl->webkitGetUserMedia(options, successCallback.release(), errorCallback.release(), ec);
     55
     56    if (ec)
     57        setDOMException(exec, ec);
     58
    5359    return jsUndefined();
    5460}
  • trunk/Source/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp

    r83287 r86055  
    2828#if ENABLE(MEDIA_STREAM)
    2929
     30#include "ExceptionCode.h"
    3031#include "Navigator.h"
    3132#include "V8Binding.h"
     
    4344
    4445    v8::TryCatch exceptionCatcher;
    45     String options = toWebCoreString(args[0]);
     46    v8::Handle<v8::String> options = args[0]->ToString();
    4647    if (exceptionCatcher.HasCaught())
    4748        return throwError(exceptionCatcher.Exception());
    4849
    4950    bool succeeded = false;
    50 
    5151    RefPtr<NavigatorUserMediaSuccessCallback> successCallback = createFunctionOnlyCallback<V8NavigatorUserMediaSuccessCallback>(args[1], succeeded);
    5252    if (!succeeded)
     
    5858        return v8::Undefined();
    5959
     60    ExceptionCode ec = 0;
    6061    Navigator* navigator = V8Navigator::toNative(args.Holder());
    61     navigator->webkitGetUserMedia(options, successCallback.release(), errorCallback.release());
    62     return v8::Undefined();
     62    navigator->webkitGetUserMedia(toWebCoreString(options), successCallback.release(), errorCallback.release(), ec);
     63    return throwError(ec);
    6364}
    6465
  • trunk/Source/WebCore/page/Navigator.cpp

    r85030 r86055  
    246246
    247247#if ENABLE(MEDIA_STREAM)
    248 void Navigator::webkitGetUserMedia(const String& options,
    249                                    PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback,
    250                                    PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
     248void Navigator::webkitGetUserMedia(const String&, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&)
    251249{
    252250    // FIXME: implement a call to the media stream context when available.
  • trunk/Source/WebCore/page/Navigator.h

    r84736 r86055  
    6969
    7070#if ENABLE(MEDIA_STREAM)
    71     virtual void webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>,
    72                                     PassRefPtr<NavigatorUserMediaErrorCallback> = 0);
     71    virtual void webkitGetUserMedia(const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&);
    7372#endif
    7473
  • trunk/Source/WebCore/page/Navigator.idl

    r84764 r86055  
    5757        [Custom, EnabledAtRuntime] void webkitGetUserMedia(in DOMString options,
    5858                                                           in [Callback=FunctionOnly] NavigatorUserMediaSuccessCallback successCallback,
    59                                                            in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback);
     59                                                           in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback)
     60            raises(DOMException);
    6061#endif
    6162    };
Note: See TracChangeset for help on using the changeset viewer.