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

Unified Diff: Source/modules/crypto/CryptoResultImpl.cpp

Issue 141413003: [webcrypto] Match the error handling defined by the spec. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 11 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
« no previous file with comments | « Source/modules/crypto/CryptoResultImpl.h ('k') | Source/modules/crypto/Key.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/CryptoResultImpl.cpp
diff --git a/Source/modules/crypto/CryptoResultImpl.cpp b/Source/modules/crypto/CryptoResultImpl.cpp
index cffb519e3f35e01e75dc70b83d138f47c8f74399..ce80306b63d3970a453c414a65d0a1b5c12d7a0a 100644
--- a/Source/modules/crypto/CryptoResultImpl.cpp
+++ b/Source/modules/crypto/CryptoResultImpl.cpp
@@ -45,9 +45,6 @@ namespace WebCore {
CryptoResultImpl::~CryptoResultImpl()
{
- ASSERT(m_finished);
- ASSERT(!m_promiseResolver.get());
- ASSERT(!m_requestState.isValid());
}
PassRefPtr<CryptoResultImpl> CryptoResultImpl::create(ScriptPromise promise)
@@ -55,16 +52,23 @@ PassRefPtr<CryptoResultImpl> CryptoResultImpl::create(ScriptPromise promise)
return adoptRef(new CryptoResultImpl(activeExecutionContext(), promise));
}
-void CryptoResultImpl::completeWithError()
+void CryptoResultImpl::completeWithError(const blink::WebString& errorDetails)
{
ASSERT(!m_finished);
if (canCompletePromise()) {
DOMRequestState::Scope scope(m_requestState);
+ if (!errorDetails.isEmpty()) {
+ // FIXME: Include the line number which started the crypto operation.
+ executionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, errorDetails);
+ }
m_promiseResolver->reject(ScriptValue::createNull());
}
+}
- finish();
+void CryptoResultImpl::completeWithError()
+{
+ completeWithError(blink::WebString());
}
void CryptoResultImpl::completeWithBuffer(const blink::WebArrayBuffer& buffer)
« no previous file with comments | « Source/modules/crypto/CryptoResultImpl.h ('k') | Source/modules/crypto/Key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698