Invalid MediaSource duration value should throw TyperError instead of InvalidStateError
authornael.ouedraogo@crf.canon.fr <nael.ouedraogo@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 May 2017 09:14:25 +0000 (09:14 +0000)
committernael.ouedraogo@crf.canon.fr <nael.ouedraogo@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 May 2017 09:14:25 +0000 (09:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171653

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Rebaseline test results.

* web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt:

Source/WebCore:

Modify MediaSource::setDuration to throw a TypeError when duration value is invalid as per MSE specification
(https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-duration).

Update expectations of corresponding WPT test.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::setDuration):
(WebCore::MediaSource::setDurationInternal):

LayoutTests:

Modify MediaSource::setDuration to throw a TypeError when duration value is invalid as per MSE specification
(https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-duration).

Update expectations of corresponding WPT test.

* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt: Added.
* platform/mac-elcapitan/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt: Added.
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216860 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-elcapitan/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/MediaSource.cpp

index 25ccd54..dd29039 100644 (file)
@@ -1,3 +1,20 @@
+2017-05-15  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
+
+        Invalid MediaSource duration value should throw TyperError instead of InvalidStateError
+        https://bugs.webkit.org/show_bug.cgi?id=171653
+
+        Reviewed by Chris Dumez.
+
+        Modify MediaSource::setDuration to throw a TypeError when duration value is invalid as per MSE specification
+        (https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-duration).
+
+        Update expectations of corresponding WPT test.
+
+        * platform/gtk/TestExpectations:
+        * platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt: Added.
+        * platform/mac-elcapitan/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt: Added.
+        * platform/mac/TestExpectations:
+
 2017-05-15  Gwang Yoon Hwang  <yoon@igalia.com>
 
         [CAIRO] Painting an image mask with a matrix above Pixman's limit breaks internal states of Cairo
index 9737cba..fbe588f 100644 (file)
@@ -1,3 +1,14 @@
+2017-05-15  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
+
+        Invalid MediaSource duration value should throw TyperError instead of InvalidStateError
+        https://bugs.webkit.org/show_bug.cgi?id=171653
+
+        Reviewed by Chris Dumez.
+
+        Rebaseline test results.
+
+        * web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt:
+
 2017-05-14  Sam Weinig  <sam@webkit.org>
 
         [WebIDL/DOM] Remove need for custom bindings for HTMLAllCollection and bring up to spec
index 42e0c97..c159b07 100644 (file)
@@ -1,9 +1,9 @@
 
 PASS Set duration to 2^31 - 1 
 PASS Set duration to 1 
-PASS Set duration to Number.MAX_VALUE 
+FAIL Set duration to Number.MAX_VALUE assert_equals: mediaSource.duration expected 1.7976931348623157e+308 but got Infinity
 PASS Set duration to Number.MIN_VALUE 
-PASS Set duration to Number.MAX_VALUE - 1 
+FAIL Set duration to Number.MAX_VALUE - 1 assert_equals: mediaSource.duration expected 1.7976931348623157e+308 but got Infinity
 PASS Set duration to Number.MIN_VALUE - 1 
 PASS Set duration to Number.POSITIVE_INFINITY 
 PASS Set duration to Number.NEGATIVE_INFINITY 
index 9e105c0..e849eac 100644 (file)
@@ -240,7 +240,6 @@ webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-con
 webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-bitrate.html [ Failure ]
 webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framerate.html [ Failure ]
 webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v-framesize.html [ Failure ]
-webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html [ Failure ]
 webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-duration.html [ Failure ]
 webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-endofstream.html [ Failure ]
 webkit.org/b/167108 imported/w3c/web-platform-tests/media-source/mediasource-errors.html [ Failure ]
diff --git a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt
new file mode 100644 (file)
index 0000000..659b1e2
--- /dev/null
@@ -0,0 +1,17 @@
+
+Harness Error (TIMEOUT), message = null
+
+PASS Set duration to 2^31 - 1 
+PASS Set duration to 1 
+FAIL Set duration to Number.MAX_VALUE assert_equals: mediaSource.duration expected 1.7976931348623157e+308 but got Infinity
+PASS Set duration to Number.MIN_VALUE 
+FAIL Set duration to Number.MAX_VALUE - 1 assert_equals: mediaSource.duration expected 1.7976931348623157e+308 but got Infinity
+PASS Set duration to Number.MIN_VALUE - 1 
+FAIL Set duration to Number.POSITIVE_INFINITY assert_equals: mediaElement.duration expected Infinity but got 0
+PASS Set duration to Number.NEGATIVE_INFINITY 
+PASS Set duration to lowest value. 
+PASS Set duration to a negative double. 
+PASS Set duration to a positive double. 
+TIMEOUT Set duration to zero Test timed out
+PASS Set duration to NaN 
+
diff --git a/LayoutTests/platform/mac-elcapitan/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt b/LayoutTests/platform/mac-elcapitan/imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions-expected.txt
new file mode 100644 (file)
index 0000000..4871ce1
--- /dev/null
@@ -0,0 +1,17 @@
+
+Harness Error (TIMEOUT), message = null
+
+PASS Set duration to 2^31 - 1 
+PASS Set duration to 1 
+FAIL Set duration to Number.MAX_VALUE assert_equals: mediaSource.duration expected 1.7976931348623157e+308 but got Infinity
+PASS Set duration to Number.MIN_VALUE 
+FAIL Set duration to Number.MAX_VALUE - 1 assert_equals: mediaSource.duration expected 1.7976931348623157e+308 but got Infinity
+PASS Set duration to Number.MIN_VALUE - 1 
+PASS Set duration to Number.POSITIVE_INFINITY 
+PASS Set duration to Number.NEGATIVE_INFINITY 
+PASS Set duration to lowest value. 
+PASS Set duration to a negative double. 
+PASS Set duration to a positive double. 
+TIMEOUT Set duration to zero Test timed out
+PASS Set duration to NaN 
+
index 011e41e..ea64c37 100644 (file)
@@ -993,7 +993,6 @@ webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/U
 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-append-buffer.html [ Skip ]
 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-appendbuffer-quota-exceeded.html [ Skip ]
 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-config-change-mp4-av-framesize.html [ Skip ]
-webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html [ Skip ]
 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-endofstream.html [ Skip ]
 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-errors.html [ Skip ]
 webkit.org/b/161725 [ Yosemite+ ] imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html [ Skip ]
index f561afc..2b9c066 100644 (file)
@@ -1,3 +1,19 @@
+2017-05-15  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
+
+        Invalid MediaSource duration value should throw TyperError instead of InvalidStateError
+        https://bugs.webkit.org/show_bug.cgi?id=171653
+
+        Reviewed by Chris Dumez.
+
+        Modify MediaSource::setDuration to throw a TypeError when duration value is invalid as per MSE specification
+        (https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-duration).
+
+        Update expectations of corresponding WPT test.
+
+        * Modules/mediasource/MediaSource.cpp:
+        (WebCore::MediaSource::setDuration):
+        (WebCore::MediaSource::setDurationInternal):
+
 2017-05-15  Gwang Yoon Hwang  <yoon@igalia.com>
 
         [CAIRO] Painting an image mask with a matrix above Pixman's limit breaks internal states of Cairo
index a5d848d..f9f913e 100644 (file)
@@ -463,18 +463,18 @@ void MediaSource::monitorSourceBuffers()
 ExceptionOr<void> MediaSource::setDuration(double duration)
 {
     // 2.1 Attributes - Duration
-    // https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#attributes
+    // https://www.w3.org/TR/2016/REC-media-source-20161117/#attributes
 
     // On setting, run the following steps:
-    // 1. If the value being set is negative or NaN then throw an INVALID_ACCESS_ERR exception and abort these steps.
+    // 1. If the value being set is negative or NaN then throw a TypeError exception and abort these steps.
     if (duration < 0.0 || std::isnan(duration))
-        return Exception { INVALID_ACCESS_ERR };
+        return Exception { TypeError };
 
-    // 2. If the readyState attribute is not "open" then throw an INVALID_STATE_ERR exception and abort these steps.
+    // 2. If the readyState attribute is not "open" then throw an InvalidStateError exception and abort these steps.
     if (!isOpen())
         return Exception { INVALID_STATE_ERR };
 
-    // 3. If the updating attribute equals true on any SourceBuffer in sourceBuffers, then throw an INVALID_STATE_ERR
+    // 3. If the updating attribute equals true on any SourceBuffer in sourceBuffers, then throw an InvalidStateError
     // exception and abort these steps.
     for (auto& sourceBuffer : *m_sourceBuffers) {
         if (sourceBuffer->updating())
@@ -488,7 +488,7 @@ ExceptionOr<void> MediaSource::setDuration(double duration)
 ExceptionOr<void> MediaSource::setDurationInternal(const MediaTime& duration)
 {
     // 2.4.6 Duration Change
-    // https://rawgit.com/w3c/media-source/45627646344eea0170dd1cbc5a3d508ca751abb8/media-source-respec.html#duration-change-algorithm
+    // https://www.w3.org/TR/2016/REC-media-source-20161117/#duration-change-algorithm
 
     MediaTime newDuration = duration;