Merge from Chromium at DEPS revision 257591
This commit was generated by merge_to_master.py.
Change-Id: I834f3ca85c1ef7ec2c1061847a3d92aa461da043
diff --git a/Source/bindings/v8/ExceptionState.h b/Source/bindings/v8/ExceptionState.h
index 5235318..fbe338f 100644
--- a/Source/bindings/v8/ExceptionState.h
+++ b/Source/bindings/v8/ExceptionState.h
@@ -50,17 +50,14 @@
DeletionContext,
GetterContext,
SetterContext,
+ EnumerationContext,
+ QueryContext,
+ IndexedGetterContext,
+ IndexedSetterContext,
+ IndexedDeletionContext,
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_propertyName(0)
- , m_interfaceName(0)
- , m_creationContext(creationContext)
- , m_isolate(isolate) { }
-
ExceptionState(Context context, const char* propertyName, const char* interfaceName, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate)
: m_code(0)
, m_context(context)
@@ -75,26 +72,24 @@
, m_propertyName(0)
, m_interfaceName(interfaceName)
, m_creationContext(creationContext)
- , m_isolate(isolate) { ASSERT(m_context == ConstructionContext); }
+ , m_isolate(isolate) { ASSERT(m_context == ConstructionContext || m_context == EnumerationContext || m_context == IndexedSetterContext || m_context == IndexedGetterContext || m_context == IndexedDeletionContext); }
virtual void throwDOMException(const ExceptionCode&, const String& message);
virtual void throwTypeError(const String& message);
virtual void throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage = String());
- // Please don't use these methods. Use ::throwDOMException and ::throwTypeError, and pass in a useful exception message.
- virtual void throwUninformativeAndGenericDOMException(const ExceptionCode& ec) { throwDOMException(ec, String()); }
-
bool hadException() const { return !m_exception.isEmpty() || m_code; }
void clearException();
ExceptionCode code() const { return m_code; }
+ const String& message() const { return m_message; }
bool throwIfNeeded()
{
if (m_exception.isEmpty()) {
if (!m_code)
return false;
- throwUninformativeAndGenericDOMException(m_code);
+ throwDOMException(m_code, String()); // FIXME: Do we ever hit this? If so, where and why?
}
V8ThrowException::throwError(m_exception.newLocal(m_isolate), m_isolate);
@@ -113,6 +108,7 @@
protected:
ExceptionCode m_code;
Context m_context;
+ String m_message;
const char* m_propertyName;
const char* m_interfaceName;
@@ -129,7 +125,7 @@
// Used if exceptions can/should not be directly thrown.
class NonThrowableExceptionState FINAL : public ExceptionState {
public:
- NonThrowableExceptionState(): ExceptionState(v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { }
+ NonThrowableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { }
virtual void throwDOMException(const ExceptionCode&, const String& message) OVERRIDE;
virtual void throwTypeError(const String& message = String()) OVERRIDE;
virtual void throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage = String()) OVERRIDE;
@@ -138,7 +134,7 @@
// Used if any exceptions thrown are ignorable.
class TrackExceptionState FINAL : public ExceptionState {
public:
- TrackExceptionState(): ExceptionState(v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { }
+ TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()) { }
virtual void throwDOMException(const ExceptionCode&, const String& message) OVERRIDE;
virtual void throwTypeError(const String& message = String()) OVERRIDE;
virtual void throwSecurityError(const String& sanitizedMessage, const String& unsanitizedMessage = String()) OVERRIDE;