Changeset 279978 in webkit


Ignore:
Timestamp:
Jul 15, 2021 11:15:47 PM (12 months ago)
Author:
Chris Dumez
Message:

Add support for MediaError.message
https://bugs.webkit.org/show_bug.cgi?id=228008

Reviewed by Alex Christensen.

Source/WebCore:

Add support for MediaError.message:

Both Chrome and Firefox already support this.

No new tests, rebaselined existing test.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::noneSupported):
(WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
(WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
(WebCore::HTMLMediaElement::userCancelledLoad):

  • html/MediaError.h:

(WebCore::MediaError::create):
(WebCore::MediaError::message const):
(WebCore::MediaError::MediaError):

  • html/MediaError.idl:

LayoutTests:

Rebaseline WPT test now that more checks are passing.

  • platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
  • platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r279973 r279978  
     12021-07-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Add support for MediaError.message
     4        https://bugs.webkit.org/show_bug.cgi?id=228008
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline WPT test now that more checks are passing.
     9
     10        * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     11        * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     12
    1132021-07-15  Jean-Yves Avenard  <jya@apple.com>
    214
  • trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r279971 r279978  
    13991399PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface prototype object
    14001400PASS MediaError interface: attribute code
    1401 FAIL MediaError interface: attribute message assert_true: The prototype object must have a property "message" expected true got false
     1401PASS MediaError interface: attribute message
    14021402PASS MediaError must be primary interface of errorVideo.error
    14031403PASS Stringification of errorVideo.error
     
    14071407PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_SRC_NOT_SUPPORTED" with the proper type
    14081408PASS MediaError interface: errorVideo.error must inherit property "code" with the proper type
    1409 FAIL MediaError interface: errorVideo.error must inherit property "message" with the proper type assert_inherits: property "message" not found in prototype chain
     1409PASS MediaError interface: errorVideo.error must inherit property "message" with the proper type
    14101410PASS AudioTrackList interface: existence and properties of interface object
    14111411PASS AudioTrackList interface object length
  • trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r279971 r279978  
    13991399PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface prototype object
    14001400PASS MediaError interface: attribute code
    1401 FAIL MediaError interface: attribute message assert_true: The prototype object must have a property "message" expected true got false
     1401PASS MediaError interface: attribute message
    14021402PASS MediaError must be primary interface of errorVideo.error
    14031403PASS Stringification of errorVideo.error
     
    14071407PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_SRC_NOT_SUPPORTED" with the proper type
    14081408PASS MediaError interface: errorVideo.error must inherit property "code" with the proper type
    1409 FAIL MediaError interface: errorVideo.error must inherit property "message" with the proper type assert_inherits: property "message" not found in prototype chain
     1409PASS MediaError interface: errorVideo.error must inherit property "message" with the proper type
    14101410PASS AudioTrackList interface: existence and properties of interface object
    14111411PASS AudioTrackList interface object length
  • trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r279971 r279978  
    13991399PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface prototype object
    14001400PASS MediaError interface: attribute code
    1401 FAIL MediaError interface: attribute message assert_true: The prototype object must have a property "message" expected true got false
     1401PASS MediaError interface: attribute message
    14021402PASS MediaError must be primary interface of errorVideo.error
    14031403PASS Stringification of errorVideo.error
     
    14071407PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_SRC_NOT_SUPPORTED" with the proper type
    14081408PASS MediaError interface: errorVideo.error must inherit property "code" with the proper type
    1409 FAIL MediaError interface: errorVideo.error must inherit property "message" with the proper type assert_inherits: property "message" not found in prototype chain
     1409PASS MediaError interface: errorVideo.error must inherit property "message" with the proper type
    14101410PASS AudioTrackList interface: existence and properties of interface object
    14111411PASS AudioTrackList interface object length
  • trunk/Source/WebCore/ChangeLog

    r279974 r279978  
     12021-07-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Add support for MediaError.message
     4        https://bugs.webkit.org/show_bug.cgi?id=228008
     5
     6        Reviewed by Alex Christensen.
     7
     8        Add support for MediaError.message:
     9        - https://html.spec.whatwg.org/multipage/media.html#mediaerror
     10
     11        Both Chrome and Firefox already support this.
     12
     13        No new tests, rebaselined existing test.
     14
     15        * html/HTMLMediaElement.cpp:
     16        (WebCore::HTMLMediaElement::noneSupported):
     17        (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
     18        (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
     19        (WebCore::HTMLMediaElement::userCancelledLoad):
     20        * html/MediaError.h:
     21        (WebCore::MediaError::create):
     22        (WebCore::MediaError::message const):
     23        (WebCore::MediaError::MediaError):
     24        * html/MediaError.idl:
     25
    1262021-07-15  Jean-Yves Avenard  <jya@apple.com>
    227
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r279914 r279978  
    20702070    // 6.1 - Set the error attribute to a new MediaError object whose code attribute is set to
    20712071    // MEDIA_ERR_SRC_NOT_SUPPORTED.
    2072     m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
     2072    m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED, "Unsupported source type"_s);
    20732073
    20742074    // 6.2 - Forget the media element's media-resource-specific text tracks.
     
    21112111    // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE.
    21122112    if (error == MediaPlayer::NetworkState::NetworkError)
    2113         m_error = MediaError::create(MediaError::MEDIA_ERR_NETWORK);
     2113        m_error = MediaError::create(MediaError::MEDIA_ERR_NETWORK, "Media failed to load"_s);
    21142114    else if (error == MediaPlayer::NetworkState::DecodeError)
    2115         m_error = MediaError::create(MediaError::MEDIA_ERR_DECODE);
     2115        m_error = MediaError::create(MediaError::MEDIA_ERR_DECODE, "Media failed to decode"_s);
    21162116    else
    21172117        ASSERT_NOT_REACHED();
     
    24952495#endif
    24962496        ) {
    2497         m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED);
     2497        m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED, "Media is encrypted"_s);
    24982498        scheduleEvent(eventNames().errorEvent);
    24992499        return;
     
    55265526
    55275527    // 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORTED.
    5528     m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
     5528    m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED, "Load was aborted"_s);
    55295529
    55305530    // 3 - Queue a task to fire a simple event named error at the media element.
  • trunk/Source/WebCore/html/MediaError.h

    r208179 r279978  
    4444    };
    4545
    46     static Ref<MediaError> create(Code code) { return adoptRef(*new MediaError(code)); }
     46    static Ref<MediaError> create(Code code, String&& message)
     47    {
     48        return adoptRef(*new MediaError(code, WTFMove(message)));
     49    }
    4750
    4851    Code code() const { return m_code; }
     52    const String& message() const { return m_message; }
    4953
    5054private:
    51     MediaError(Code code) : m_code(code) { }
     55    MediaError(Code code, String&& message)
     56        : m_code(code)
     57        , m_message(WTFMove(message))
     58    { }
    5259
    5360    Code m_code;
     61    String m_message;
    5462};
    5563
  • trunk/Source/WebCore/html/MediaError.idl

    r267813 r279978  
    3535      [Conditional=LEGACY_ENCRYPTED_MEDIA] const unsigned short MEDIA_ERR_ENCRYPTED = 5;
    3636      readonly attribute unsigned short code;
     37      readonly attribute DOMString message;
    3738};
Note: See TracChangeset for help on using the changeset viewer.