[EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates...
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2017 11:47:19 +0000 (11:47 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2017 11:47:19 +0000 (11:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168362

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

In MediaKeys::setServerCertificate(), when the CDM implementation
doesn't support server certificates, it should resolve the promise
with the 'false' value, as mandated by the specification, and not
reject it.

A test case in mock-MediaKeys-setServerCertificate.html is updated.

* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::setServerCertificate):

LayoutTests:

Update the certificates-not-supported test case, making sure the promise
is resolved with the 'false' result.

* media/encrypted-media/mock-MediaKeys-setServerCertificate-expected.txt:
* media/encrypted-media/mock-MediaKeys-setServerCertificate.html:

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

LayoutTests/ChangeLog
LayoutTests/media/encrypted-media/mock-MediaKeys-setServerCertificate-expected.txt
LayoutTests/media/encrypted-media/mock-MediaKeys-setServerCertificate.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp

index b82ac94..2a16546 100644 (file)
@@ -1,3 +1,16 @@
+2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
+
+        [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
+        https://bugs.webkit.org/show_bug.cgi?id=168362
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Update the certificates-not-supported test case, making sure the promise
+        is resolved with the 'false' result.
+
+        * media/encrypted-media/mock-MediaKeys-setServerCertificate-expected.txt:
+        * media/encrypted-media/mock-MediaKeys-setServerCertificate.html:
+
 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
index ac12309..ac1b8c3 100644 (file)
@@ -20,6 +20,7 @@ Promise resolved OK
 
 RUN(mock.supportsServerCertificates = false)
 RUN(promise = mediaKeys.setServerCertificate(stringToUInt8Array("valid")))
-Promise rejected correctly OK
+Promise resolved OK
+EXPECTED (false == 'false') OK
 END OF TEST
 
index 3c66baa..9a077f3 100644 (file)
         function() {
             run('mock.supportsServerCertificates = false');
             run('promise = mediaKeys.setServerCertificate(stringToUInt8Array("valid"))');
-            shouldReject(promise).then(next, next);
+            shouldResolve(promise).then(function(result) {
+                testExpected(result, false);
+                next();
+            }, next);
         },
     ];
     </script>
index 42dae43..ea8fc35 100644 (file)
@@ -1,3 +1,20 @@
+2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
+
+        [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
+        https://bugs.webkit.org/show_bug.cgi?id=168362
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        In MediaKeys::setServerCertificate(), when the CDM implementation
+        doesn't support server certificates, it should resolve the promise
+        with the 'false' value, as mandated by the specification, and not
+        reject it.
+
+        A test case in mock-MediaKeys-setServerCertificate.html is updated.
+
+        * Modules/encryptedmedia/MediaKeys.cpp:
+        (WebCore::MediaKeys::setServerCertificate):
+
 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
index a7b050a..c8bc5ae 100644 (file)
@@ -78,7 +78,7 @@ void MediaKeys::setServerCertificate(const BufferSource& serverCertificate, Ref<
     // 1. If the Key System implementation represented by this object's cdm implementation value does not support
     //    server certificates, return a promise resolved with false.
     if (!m_implementation->supportsServerCertificates()) {
-        promise->reject(false);
+        promise->resolve<IDLBoolean>(false);
         return;
     }