Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp

Issue 2342953002: Update EME errors to use TypeError (Closed)
Patch Set: changes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
index ff360620855c3c421f825620bb32e8200a5006fc..903174dc62f920aac53fc554d7e5d9125707a6dd 100644
--- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
+++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp
@@ -25,7 +25,9 @@
#include "modules/encryptedmedia/MediaKeys.h"
+#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/V8ThrowException.h"
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMException.h"
#include "core/dom/ExceptionCode.h"
@@ -190,20 +192,21 @@ ScriptPromise MediaKeys::setServerCertificate(
// The setServerCertificate(serverCertificate) method provides a server
// certificate to be used to encrypt messages to the license server.
// It must run the following steps:
- // 1. If serverCertificate is an empty array, return a promise rejected
- // with a new DOMException whose name is "InvalidAccessError".
+ // 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.
+ // TODO(jrummell): Provide a way to determine if the CDM supports this.
+ // http://crbug.com/647816.
+ //
+ // 2. If serverCertificate is an empty array, return a promise rejected
+ // with a new a newly created TypeError.
if (!serverCertificate.byteLength()) {
- return ScriptPromise::rejectWithDOMException(
- scriptState,
- DOMException::create(InvalidAccessError,
- "The serverCertificate parameter is empty."));
+ return ScriptPromise::reject(
+ scriptState, V8ThrowException::createTypeError(
+ scriptState->isolate(),
+ "The serverCertificate parameter is empty."));
}
- // 2. If the keySystem does not support server certificates, return a
- // promise rejected with a new DOMException whose name is
- // "NotSupportedError".
- // (Let the CDM decide whether to support this or not.)
-
// 3. Let certificate be a copy of the contents of the serverCertificate
// parameter.
DOMArrayBuffer* serverCertificateBuffer = DOMArrayBuffer::create(

Powered by Google App Engine
This is Rietveld 408576698