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

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

Issue 1952893003: Implement custom element construction and some 'define' checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 void ExceptionState::throwTypeError(const String& message) 103 void ExceptionState::throwTypeError(const String& message)
104 { 104 {
105 ASSERT(m_isolate); 105 ASSERT(m_isolate);
106 m_code = V8TypeError; 106 m_code = V8TypeError;
107 m_message = message; 107 m_message = message;
108 setException(V8ThrowException::createTypeError(m_isolate, addExceptionContex t(message))); 108 setException(V8ThrowException::createTypeError(m_isolate, addExceptionContex t(message)));
109 } 109 }
110 110
111 void ExceptionState::throwSyntaxError(const String& message)
112 {
113 ASSERT(m_isolate);
114 m_code = V8SyntaxError;
115 m_message = message;
116 setException(V8ThrowException::createSyntaxError(m_isolate, addExceptionCont ext(message)));
117 }
118
111 void ExceptionState::throwRangeError(const String& message) 119 void ExceptionState::throwRangeError(const String& message)
112 { 120 {
113 ASSERT(m_isolate); 121 ASSERT(m_isolate);
114 m_code = V8RangeError; 122 m_code = V8RangeError;
115 m_message = message; 123 m_message = message;
116 setException(V8ThrowException::createRangeError(m_isolate, addExceptionConte xt(message))); 124 setException(V8ThrowException::createRangeError(m_isolate, addExceptionConte xt(message)));
117 } 125 }
118 126
119 void NonThrowableExceptionState::throwDOMException(const ExceptionCode& ec, cons t String& message) 127 void NonThrowableExceptionState::throwDOMException(const ExceptionCode& ec, cons t String& message)
120 { 128 {
121 ASSERT_NOT_REACHED(); 129 ASSERT_NOT_REACHED();
122 m_code = ec; 130 m_code = ec;
123 m_message = message; 131 m_message = message;
124 } 132 }
125 133
126 void NonThrowableExceptionState::throwTypeError(const String& message) 134 void NonThrowableExceptionState::throwTypeError(const String& message)
127 { 135 {
128 ASSERT_NOT_REACHED(); 136 ASSERT_NOT_REACHED();
129 m_code = V8TypeError; 137 m_code = V8TypeError;
130 m_message = message; 138 m_message = message;
131 } 139 }
132 140
133 void NonThrowableExceptionState::throwSecurityError(const String& sanitizedMessa ge, const String&) 141 void NonThrowableExceptionState::throwSecurityError(const String& sanitizedMessa ge, const String&)
134 { 142 {
135 ASSERT_NOT_REACHED(); 143 ASSERT_NOT_REACHED();
136 m_code = SecurityError; 144 m_code = SecurityError;
137 m_message = sanitizedMessage; 145 m_message = sanitizedMessage;
138 } 146 }
139 147
148 void NonThrowableExceptionState::throwSyntaxError(const String& message)
149 {
150 ASSERT_NOT_REACHED();
151 m_code = V8SyntaxError;
152 m_message = message;
153 }
154
140 void NonThrowableExceptionState::throwRangeError(const String& message) 155 void NonThrowableExceptionState::throwRangeError(const String& message)
141 { 156 {
142 ASSERT_NOT_REACHED(); 157 ASSERT_NOT_REACHED();
143 m_code = V8RangeError; 158 m_code = V8RangeError;
144 m_message = message; 159 m_message = message;
145 } 160 }
146 161
147 void TrackExceptionState::throwDOMException(const ExceptionCode& ec, const Strin g& message) 162 void TrackExceptionState::throwDOMException(const ExceptionCode& ec, const Strin g& message)
148 { 163 {
149 m_code = ec; 164 m_code = ec;
150 m_message = message; 165 m_message = message;
151 } 166 }
152 167
153 void TrackExceptionState::throwTypeError(const String& message) 168 void TrackExceptionState::throwTypeError(const String& message)
154 { 169 {
155 m_code = V8TypeError; 170 m_code = V8TypeError;
156 m_message = message; 171 m_message = message;
157 } 172 }
158 173
159 void TrackExceptionState::throwSecurityError(const String& sanitizedMessage, con st String&) 174 void TrackExceptionState::throwSecurityError(const String& sanitizedMessage, con st String&)
160 { 175 {
161 m_code = SecurityError; 176 m_code = SecurityError;
162 m_message = sanitizedMessage; 177 m_message = sanitizedMessage;
163 } 178 }
164 179
180 void TrackExceptionState::throwSyntaxError(const String& message)
181 {
182 m_code = V8SyntaxError;
183 m_message = message;
184 }
185
165 void TrackExceptionState::throwRangeError(const String& message) 186 void TrackExceptionState::throwRangeError(const String& message)
166 { 187 {
167 m_code = V8RangeError; 188 m_code = V8RangeError;
168 m_message = message; 189 m_message = message;
169 } 190 }
170 191
171 String ExceptionState::addExceptionContext(const String& message) const 192 String ExceptionState::addExceptionContext(const String& message) const
172 { 193 {
173 if (message.isEmpty()) 194 if (message.isEmpty())
174 return message; 195 return message;
(...skipping 17 matching lines...) Expand all
192 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac eName(), message); 213 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac eName(), message);
193 else if (m_context == IndexedGetterContext) 214 else if (m_context == IndexedGetterContext)
194 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa me(), message); 215 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa me(), message);
195 else if (m_context == IndexedSetterContext) 216 else if (m_context == IndexedSetterContext)
196 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa me(), message); 217 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa me(), message);
197 } 218 }
198 return processedMessage; 219 return processedMessage;
199 } 220 }
200 221
201 } // namespace blink 222 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698