Changeset 155579 in webkit


Ignore:
Timestamp:
Sep 11, 2013 4:46:44 PM (11 years ago)
Author:
eric.carlson@apple.com
Message:

[MediaStream API] Updating NavigatorUserMediaError to match the spec
https://bugs.webkit.org/show_bug.cgi?id=120880

Reviewed by Darin Adler.

Merge https://chromium.googlesource.com/chromium/blink/+/f07305e49ddebaa166f5dee514bcc881a8efd341
by Tommy Widenflycht.

The Blink change did not have any test changes because they don't appear to have any tests
for NavigatorUserMediaError. I can't add tests now because the MediaStream feature isn't enabled
yet, so https://bugs.webkit.org/show_bug.cgi?id=121182 tracks adding tests.

  • Modules/mediastream/NavigatorUserMediaError.h:

(WebCore::NavigatorUserMediaError::create):
(WebCore::NavigatorUserMediaError::name):
(WebCore::NavigatorUserMediaError::message):
(WebCore::NavigatorUserMediaError::constraintName):
(WebCore::NavigatorUserMediaError::NavigatorUserMediaError):

  • Modules/mediastream/NavigatorUserMediaError.idl:
  • Modules/mediastream/UserMediaRequest.cpp:

(WebCore::UserMediaRequest::fail):
(WebCore::UserMediaRequest::failConstraint):

  • Modules/mediastream/UserMediaRequest.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r155573 r155579  
     12013-09-11  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [MediaStream API] Updating NavigatorUserMediaError to match the spec
     4        https://bugs.webkit.org/show_bug.cgi?id=120880
     5
     6        Reviewed by Darin Adler.
     7       
     8        Merge https://chromium.googlesource.com/chromium/blink/+/f07305e49ddebaa166f5dee514bcc881a8efd341
     9        by Tommy Widenflycht.
     10
     11        The Blink change did not have any test changes because they don't appear to have any tests
     12        for NavigatorUserMediaError. I can't add tests now because the MediaStream feature isn't enabled
     13        yet, so https://bugs.webkit.org/show_bug.cgi?id=121182 tracks adding tests.
     14
     15        * Modules/mediastream/NavigatorUserMediaError.h:
     16        (WebCore::NavigatorUserMediaError::create):
     17        (WebCore::NavigatorUserMediaError::name):
     18        (WebCore::NavigatorUserMediaError::message):
     19        (WebCore::NavigatorUserMediaError::constraintName):
     20        (WebCore::NavigatorUserMediaError::NavigatorUserMediaError):
     21        * Modules/mediastream/NavigatorUserMediaError.idl:
     22        * Modules/mediastream/UserMediaRequest.cpp:
     23        (WebCore::UserMediaRequest::fail):
     24        (WebCore::UserMediaRequest::failConstraint):
     25        * Modules/mediastream/UserMediaRequest.h:
     26
    1272013-09-11  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
    228
  • trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaError.h

    r123945 r155579  
    3535class NavigatorUserMediaError : public RefCounted<NavigatorUserMediaError> {
    3636public:
    37     // Should be kept in sync with the values in the idl file.
    38     enum ErrorCode {
    39         PERMISSION_DENIED = 1
    40     };
    41 
    42     static PassRefPtr<NavigatorUserMediaError> create(ErrorCode code)
     37    static PassRefPtr<NavigatorUserMediaError> create(const String& name, const String& message, const String& constraintName)
    4338    {
    44         return adoptRef(new NavigatorUserMediaError(code));
     39        return adoptRef(new NavigatorUserMediaError(name, message, constraintName));
    4540    }
    4641
    4742    virtual ~NavigatorUserMediaError() { }
    4843
    49     ErrorCode code() const { return m_code; }
     44    const String& name() const { return m_name; }
     45    const String& message() const { return m_message; }
     46    const String& constraintName() const { return m_constraintName; }
    5047
    5148private:
    52     explicit NavigatorUserMediaError(ErrorCode code) : m_code(code) { }
     49    NavigatorUserMediaError(const String& name, const String& message, const String& constraintName)
     50        : m_name(name)
     51        , m_message(message)
     52        , m_constraintName(constraintName)
     53    {
     54    }
    5355
    54     ErrorCode m_code;
     56    String m_name;
     57    String m_message;
     58    String m_constraintName;
    5559};
    5660
  • trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaError.idl

    r149796 r155579  
    2727    Conditional=MEDIA_STREAM
    2828] interface NavigatorUserMediaError {
    29     const unsigned short PERMISSION_DENIED = 1;
    30     readonly attribute unsigned short code;
     29    readonly attribute DOMString name;
     30    readonly attribute DOMString message;
     31    readonly attribute DOMString constraintName;
    3132};
    3233
  • trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp

    r155573 r155579  
    145145}
    146146
    147 void UserMediaRequest::fail()
     147void UserMediaRequest::fail(const String& description)
    148148{
    149149    if (!m_scriptExecutionContext)
    150150        return;
    151151
    152     if (m_errorCallback) {
    153         RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(NavigatorUserMediaError::PERMISSION_DENIED);
    154         m_errorCallback->handleEvent(error.get());
    155     }
     152    if (m_errorCallback)
     153        m_errorCallback->handleEvent(NavigatorUserMediaError::create(ASCIILiteral("PERMISSION_DENIED"), description, String()).get());
     154}
     155
     156void UserMediaRequest::failConstraint(const String& constraintName, const String& description)
     157{
     158    ASSERT(!constraintName.isEmpty());
     159    if (!m_scriptExecutionContext)
     160        return;
     161   
     162    if (m_errorCallback)
     163        m_errorCallback->handleEvent(NavigatorUserMediaError::create(ASCIILiteral("CONSTRAINT_NOT_SATISFIED"), description, constraintName).get());
    156164}
    157165
  • trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h

    r155573 r155579  
    6565
    6666    void succeed(PassRefPtr<MediaStreamDescriptor>);
    67     void fail();
     67    void fail(const String& description);
     68    void failConstraint(const String& constraintName, const String& description);
    6869
    6970    MediaConstraints* audioConstraints() const;
Note: See TracChangeset for help on using the changeset viewer.