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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ExceptionState.h

Issue 2249593002: binding: ExceptionState no longer takes |creationContext|. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a compile error. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 GetterContext, 58 GetterContext,
59 SetterContext, 59 SetterContext,
60 EnumerationContext, 60 EnumerationContext,
61 QueryContext, 61 QueryContext,
62 IndexedGetterContext, 62 IndexedGetterContext,
63 IndexedSetterContext, 63 IndexedSetterContext,
64 IndexedDeletionContext, 64 IndexedDeletionContext,
65 UnknownContext, // FIXME: Remove this once we've flipped over to the new API. 65 UnknownContext, // FIXME: Remove this once we've flipped over to the new API.
66 }; 66 };
67 67
68 ExceptionState(ContextType context, const char* propertyName, const char* in terfaceName, const v8::Local<v8::Object>& creationContext, v8::Isolate* isolate) 68 ExceptionState(v8::Isolate* isolate, ContextType contextType, const char* in terfaceName, const char* propertyName)
69 : m_code(0) 69 : m_code(0)
70 , m_context(context) 70 , m_context(contextType)
71 , m_propertyName(propertyName) 71 , m_propertyName(propertyName)
72 , m_interfaceName(interfaceName) 72 , m_interfaceName(interfaceName)
73 , m_creationContext(creationContext)
74 , m_isolate(isolate) { } 73 , m_isolate(isolate) { }
75 74
76 ExceptionState(ContextType context, const char* interfaceName, const v8::Loc al<v8::Object>& creationContext, v8::Isolate* isolate) 75 ExceptionState(v8::Isolate* isolate, ContextType contextType, const char* in terfaceName)
77 : m_code(0) 76 : ExceptionState(isolate, contextType, interfaceName, nullptr)
78 , m_context(context) 77 {
79 , m_propertyName(0) 78 #if ENABLE(ASSERT)
80 , m_interfaceName(interfaceName) 79 switch (m_context) {
81 , m_creationContext(creationContext) 80 case ConstructionContext:
82 , m_isolate(isolate) { ASSERT(m_context == ConstructionContext || m_cont ext == EnumerationContext || m_context == IndexedSetterContext || m_context == I ndexedGetterContext || m_context == IndexedDeletionContext); } 81 case EnumerationContext:
82 case IndexedGetterContext:
83 case IndexedSetterContext:
84 case IndexedDeletionContext:
85 break;
86 default:
87 NOTREACHED();
88 }
89 #endif // ENABLE(ASSERT)
90 }
91
92 ExceptionState(ContextType context, const char* propertyName, const char* in terfaceName, const v8::Local<v8::Object>& creationContext, v8::Isolate* isolate) // DEPRECATED
93 : ExceptionState(isolate, context, interfaceName, propertyName) { }
94
95 ExceptionState(ContextType context, const char* interfaceName, const v8::Loc al<v8::Object>& creationContext, v8::Isolate* isolate) // DEPRECATED
96 : ExceptionState(isolate, context, interfaceName) { }
83 97
84 virtual void throwDOMException(const ExceptionCode&, const String& message); 98 virtual void throwDOMException(const ExceptionCode&, const String& message);
85 virtual void throwTypeError(const String& message); 99 virtual void throwTypeError(const String& message);
86 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String()); 100 virtual void throwSecurityError(const String& sanitizedMessage, const String & unsanitizedMessage = String());
87 virtual void throwRangeError(const String& message); 101 virtual void throwRangeError(const String& message);
88 102
89 bool hadException() const { return !m_exception.isEmpty() || m_code; } 103 bool hadException() const { return !m_exception.isEmpty() || m_code; }
90 void clearException(); 104 void clearException();
91 105
92 ExceptionCode code() const { return m_code; } 106 ExceptionCode code() const { return m_code; }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 const char* m_propertyName; 143 const char* m_propertyName;
130 const char* m_interfaceName; 144 const char* m_interfaceName;
131 145
132 private: 146 private:
133 void setException(v8::Local<v8::Value>); 147 void setException(v8::Local<v8::Value>);
134 void throwException(); 148 void throwException();
135 149
136 String addExceptionContext(const String&) const; 150 String addExceptionContext(const String&) const;
137 151
138 ScopedPersistent<v8::Value> m_exception; 152 ScopedPersistent<v8::Value> m_exception;
139 v8::Local<v8::Object> m_creationContext;
140 v8::Isolate* m_isolate; 153 v8::Isolate* m_isolate;
141 #if ENABLE(ASSERT) 154 #if ENABLE(ASSERT)
142 OnStackObjectChecker m_onStackObjectChecker; 155 OnStackObjectChecker m_onStackObjectChecker;
143 #endif 156 #endif
144 }; 157 };
145 158
146 // Used if exceptions can/should not be directly thrown. 159 // Used if exceptions can/should not be directly thrown.
147 class CORE_EXPORT NonThrowableExceptionState final : public ExceptionState { 160 class CORE_EXPORT NonThrowableExceptionState final : public ExceptionState {
148 WTF_MAKE_NONCOPYABLE(NonThrowableExceptionState); 161 WTF_MAKE_NONCOPYABLE(NonThrowableExceptionState);
149 public: 162 public:
(...skipping 11 matching lines...) Expand all
161 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Local<v8::Object>(), v8::Isolate::GetCurrent()) { } 174 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0, v8::Local<v8::Object>(), v8::Isolate::GetCurrent()) { }
162 void throwDOMException(const ExceptionCode&, const String& message) override ; 175 void throwDOMException(const ExceptionCode&, const String& message) override ;
163 void throwTypeError(const String& message = String()) override; 176 void throwTypeError(const String& message = String()) override;
164 void throwSecurityError(const String& sanitizedMessage, const String& unsani tizedMessage = String()) override; 177 void throwSecurityError(const String& sanitizedMessage, const String& unsani tizedMessage = String()) override;
165 void throwRangeError(const String& message) override; 178 void throwRangeError(const String& message) override;
166 }; 179 };
167 180
168 } // namespace blink 181 } // namespace blink
169 182
170 #endif // ExceptionState_h 183 #endif // ExceptionState_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698