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

Unified Diff: Source/bindings/v8/ExceptionState.h

Issue 87963002: Improve Crypto::getRandomValues exception messages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | « LayoutTests/crypto/worker-random-values-types-expected.txt ('k') | Source/bindings/v8/ExceptionState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ExceptionState.h
diff --git a/Source/bindings/v8/ExceptionState.h b/Source/bindings/v8/ExceptionState.h
index 576d370ee2553c3176ddb9e58bb33964d484633f..de1300b5ae72b0e319611aaf73bf4b8e6c8a374e 100644
--- a/Source/bindings/v8/ExceptionState.h
+++ b/Source/bindings/v8/ExceptionState.h
@@ -44,11 +44,39 @@ typedef int ExceptionCode;
class ExceptionState {
WTF_MAKE_NONCOPYABLE(ExceptionState);
public:
+ enum Context {
+ ConstructionContext,
+ ExecutionContext,
+ DeletionContext,
+ GetterContext,
+ SetterContext,
+ UnknownContext, // FIXME: Remove this once we've flipped over to the new API.
+ };
+
explicit ExceptionState(const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate)
: m_code(0)
+ , m_context(UnknownContext)
+ , m_property(0)
+ , m_interface(0)
+ , m_creationContext(creationContext)
+ , m_isolate(isolate) { }
+
+ ExceptionState(Context context, const char* property, const char* interface, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate)
+ : m_code(0)
+ , m_context(context)
+ , m_property(property)
+ , m_interface(interface)
, m_creationContext(creationContext)
, m_isolate(isolate) { }
+ ExceptionState(Context context, const char* interface, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate)
+ : m_code(0)
+ , m_context(context)
+ , m_property(0)
+ , m_interface(interface)
+ , m_creationContext(creationContext)
+ , m_isolate(isolate) { ASSERT(m_executionContext == ExceptionStateForConstruction); }
+
virtual void throwDOMException(const ExceptionCode&, const String& message);
virtual void throwTypeError(const String& message);
virtual void throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage = String());
@@ -74,8 +102,15 @@ public:
return true;
}
+ Context context() { return m_context; }
+ const char* property() { return m_property; }
+ const char* interface() { return m_interface; }
+
protected:
ExceptionCode m_code;
+ Context m_context;
+ const char* m_property;
+ const char* m_interface;
haraken 2013/11/26 10:49:36 Don't you want to use String instead of char*?
Mike West 2013/11/26 10:53:26 I don't want the performance hit of converting to
private:
void setException(v8::Handle<v8::Value>);
« no previous file with comments | « LayoutTests/crypto/worker-random-values-types-expected.txt ('k') | Source/bindings/v8/ExceptionState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698