Title: [279978] trunk
Revision
279978
Author
cdu...@apple.com
Date
2021-07-15 23:15:47 -0700 (Thu, 15 Jul 2021)

Log 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:
- https://html.spec.whatwg.org/multipage/media.html#mediaerror

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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (279977 => 279978)


--- trunk/LayoutTests/ChangeLog	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/LayoutTests/ChangeLog	2021-07-16 06:15:47 UTC (rev 279978)
@@ -1,3 +1,15 @@
+2021-07-15  Chris Dumez  <cdu...@apple.com>
+
+        Add support for MediaError.message
+        https://bugs.webkit.org/show_bug.cgi?id=228008
+
+        Reviewed by Alex Christensen.
+
+        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:
+
 2021-07-15  Jean-Yves Avenard  <j...@apple.com>
 
         [MSE] sequence mode is broken if GPU Process is enabled

Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (279977 => 279978)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
@@ -1398,7 +1398,7 @@
 PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface object
 PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface prototype object
 PASS MediaError interface: attribute code
-FAIL MediaError interface: attribute message assert_true: The prototype object must have a property "message" expected true got false
+PASS MediaError interface: attribute message
 PASS MediaError must be primary interface of errorVideo.error
 PASS Stringification of errorVideo.error
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_ABORTED" with the proper type
@@ -1406,7 +1406,7 @@
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_DECODE" with the proper type
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_SRC_NOT_SUPPORTED" with the proper type
 PASS MediaError interface: errorVideo.error must inherit property "code" with the proper type
-FAIL MediaError interface: errorVideo.error must inherit property "message" with the proper type assert_inherits: property "message" not found in prototype chain
+PASS MediaError interface: errorVideo.error must inherit property "message" with the proper type
 PASS AudioTrackList interface: existence and properties of interface object
 PASS AudioTrackList interface object length
 PASS AudioTrackList interface object name

Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (279977 => 279978)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
@@ -1398,7 +1398,7 @@
 PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface object
 PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface prototype object
 PASS MediaError interface: attribute code
-FAIL MediaError interface: attribute message assert_true: The prototype object must have a property "message" expected true got false
+PASS MediaError interface: attribute message
 PASS MediaError must be primary interface of errorVideo.error
 PASS Stringification of errorVideo.error
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_ABORTED" with the proper type
@@ -1406,7 +1406,7 @@
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_DECODE" with the proper type
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_SRC_NOT_SUPPORTED" with the proper type
 PASS MediaError interface: errorVideo.error must inherit property "code" with the proper type
-FAIL MediaError interface: errorVideo.error must inherit property "message" with the proper type assert_inherits: property "message" not found in prototype chain
+PASS MediaError interface: errorVideo.error must inherit property "message" with the proper type
 PASS AudioTrackList interface: existence and properties of interface object
 PASS AudioTrackList interface object length
 PASS AudioTrackList interface object name

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt (279977 => 279978)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt	2021-07-16 06:15:47 UTC (rev 279978)
@@ -1398,7 +1398,7 @@
 PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface object
 PASS MediaError interface: constant MEDIA_ERR_SRC_NOT_SUPPORTED on interface prototype object
 PASS MediaError interface: attribute code
-FAIL MediaError interface: attribute message assert_true: The prototype object must have a property "message" expected true got false
+PASS MediaError interface: attribute message
 PASS MediaError must be primary interface of errorVideo.error
 PASS Stringification of errorVideo.error
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_ABORTED" with the proper type
@@ -1406,7 +1406,7 @@
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_DECODE" with the proper type
 PASS MediaError interface: errorVideo.error must inherit property "MEDIA_ERR_SRC_NOT_SUPPORTED" with the proper type
 PASS MediaError interface: errorVideo.error must inherit property "code" with the proper type
-FAIL MediaError interface: errorVideo.error must inherit property "message" with the proper type assert_inherits: property "message" not found in prototype chain
+PASS MediaError interface: errorVideo.error must inherit property "message" with the proper type
 PASS AudioTrackList interface: existence and properties of interface object
 PASS AudioTrackList interface object length
 PASS AudioTrackList interface object name

Modified: trunk/Source/WebCore/ChangeLog (279977 => 279978)


--- trunk/Source/WebCore/ChangeLog	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/Source/WebCore/ChangeLog	2021-07-16 06:15:47 UTC (rev 279978)
@@ -1,3 +1,28 @@
+2021-07-15  Chris Dumez  <cdu...@apple.com>
+
+        Add support for MediaError.message
+        https://bugs.webkit.org/show_bug.cgi?id=228008
+
+        Reviewed by Alex Christensen.
+
+        Add support for MediaError.message:
+        - https://html.spec.whatwg.org/multipage/media.html#mediaerror
+
+        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:
+
 2021-07-15  Jean-Yves Avenard  <j...@apple.com>
 
         [Wk1] media/media-source/media-webm-opus-partial.html is a consistent failure (Enable VP8/VP9/Vorbis/Opus in WebKitLegacy)

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (279977 => 279978)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-07-16 06:15:47 UTC (rev 279978)
@@ -2069,7 +2069,7 @@
 
     // 6.1 - Set the error attribute to a new MediaError object whose code attribute is set to
     // MEDIA_ERR_SRC_NOT_SUPPORTED.
-    m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
+    m_error = MediaError::create(MediaError::MEDIA_ERR_SRC_NOT_SUPPORTED, "Unsupported source type"_s);
 
     // 6.2 - Forget the media element's media-resource-specific text tracks.
     forgetResourceSpecificTracks();
@@ -2110,9 +2110,9 @@
     // 2 - Set the error attribute to a new MediaError object whose code attribute is
     // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE.
     if (error == MediaPlayer::NetworkState::NetworkError)
-        m_error = MediaError::create(MediaError::MEDIA_ERR_NETWORK);
+        m_error = MediaError::create(MediaError::MEDIA_ERR_NETWORK, "Media failed to load"_s);
     else if (error == MediaPlayer::NetworkState::DecodeError)
-        m_error = MediaError::create(MediaError::MEDIA_ERR_DECODE);
+        m_error = MediaError::create(MediaError::MEDIA_ERR_DECODE, "Media failed to decode"_s);
     else
         ASSERT_NOT_REACHED();
 
@@ -2494,7 +2494,7 @@
         && (!document().settings().encryptedMediaAPIEnabled() || document().quirks().hasBrokenEncryptedMediaAPISupportQuirk())
 #endif
         ) {
-        m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED);
+        m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED, "Media is encrypted"_s);
         scheduleEvent(eventNames().errorEvent);
         return;
     }
@@ -5525,7 +5525,7 @@
     clearMediaPlayer();
 
     // 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORTED.
-    m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
+    m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED, "Load was aborted"_s);
 
     // 3 - Queue a task to fire a simple event named error at the media element.
     scheduleEvent(eventNames().abortEvent);

Modified: trunk/Source/WebCore/html/MediaError.h (279977 => 279978)


--- trunk/Source/WebCore/html/MediaError.h	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/Source/WebCore/html/MediaError.h	2021-07-16 06:15:47 UTC (rev 279978)
@@ -43,14 +43,22 @@
 #endif
     };
 
-    static Ref<MediaError> create(Code code) { return adoptRef(*new MediaError(code)); }
+    static Ref<MediaError> create(Code code, String&& message)
+    {
+        return adoptRef(*new MediaError(code, WTFMove(message)));
+    }
 
     Code code() const { return m_code; }
+    const String& message() const { return m_message; }
 
 private:
-    MediaError(Code code) : m_code(code) { }
+    MediaError(Code code, String&& message)
+        : m_code(code)
+        , m_message(WTFMove(message))
+    { }
 
     Code m_code;
+    String m_message;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/MediaError.idl (279977 => 279978)


--- trunk/Source/WebCore/html/MediaError.idl	2021-07-16 05:02:05 UTC (rev 279977)
+++ trunk/Source/WebCore/html/MediaError.idl	2021-07-16 06:15:47 UTC (rev 279978)
@@ -34,4 +34,5 @@
       const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
       [Conditional=LEGACY_ENCRYPTED_MEDIA] const unsigned short MEDIA_ERR_ENCRYPTED = 5;
       readonly attribute unsigned short code;
+      readonly attribute DOMString message;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to