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

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

Issue 2785943002: [Bindings] Simplify V8PrivateProperty::Symbol methods (Closed)
Patch Set: work for comments Created 3 years, 8 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // get the stack value. 90 // get the stack value.
91 v8::Local<v8::Value> error = 91 v8::Local<v8::Value> error =
92 v8::Exception::Error(v8String(isolate, domException->message())); 92 v8::Exception::Error(v8String(isolate, domException->message()));
93 exceptionObj 93 exceptionObj
94 ->SetAccessor(isolate->GetCurrentContext(), 94 ->SetAccessor(isolate->GetCurrentContext(),
95 v8AtomicString(isolate, "stack"), domExceptionStackGetter, 95 v8AtomicString(isolate, "stack"), domExceptionStackGetter,
96 domExceptionStackSetter, error) 96 domExceptionStackSetter, error)
97 .ToChecked(); 97 .ToChecked();
98 98
99 auto privateError = V8PrivateProperty::getDOMExceptionError(isolate); 99 auto privateError = V8PrivateProperty::getDOMExceptionError(isolate);
100 privateError.set(isolate->GetCurrentContext(), exceptionObj, error); 100 privateError.set(exceptionObj, error);
101 101
102 return exceptionObj; 102 return exceptionObj;
103 } 103 }
104 104
105 #define DEFINE_CREATE_AND_THROW_ERROR_FUNC(blinkErrorType, v8ErrorType, \ 105 #define DEFINE_CREATE_AND_THROW_ERROR_FUNC(blinkErrorType, v8ErrorType, \
106 defaultMessage) \ 106 defaultMessage) \
107 v8::Local<v8::Value> V8ThrowException::create##blinkErrorType( \ 107 v8::Local<v8::Value> V8ThrowException::create##blinkErrorType( \
108 v8::Isolate* isolate, const String& message) { \ 108 v8::Isolate* isolate, const String& message) { \
109 return v8::Exception::v8ErrorType( \ 109 return v8::Exception::v8ErrorType( \
110 v8String(isolate, message.isNull() ? defaultMessage : message)); \ 110 v8String(isolate, message.isNull() ? defaultMessage : message)); \
111 } \ 111 } \
112 \ 112 \
113 void V8ThrowException::throw##blinkErrorType(v8::Isolate * isolate, \ 113 void V8ThrowException::throw##blinkErrorType(v8::Isolate * isolate, \
114 const String& message) { \ 114 const String& message) { \
115 throwException(isolate, create##blinkErrorType(isolate, message)); \ 115 throwException(isolate, create##blinkErrorType(isolate, message)); \
116 } 116 }
117 117
118 DEFINE_CREATE_AND_THROW_ERROR_FUNC(Error, Error, "Error") 118 DEFINE_CREATE_AND_THROW_ERROR_FUNC(Error, Error, "Error")
119 DEFINE_CREATE_AND_THROW_ERROR_FUNC(RangeError, RangeError, "Range error") 119 DEFINE_CREATE_AND_THROW_ERROR_FUNC(RangeError, RangeError, "Range error")
120 DEFINE_CREATE_AND_THROW_ERROR_FUNC(ReferenceError, 120 DEFINE_CREATE_AND_THROW_ERROR_FUNC(ReferenceError,
121 ReferenceError, 121 ReferenceError,
122 "Reference error") 122 "Reference error")
123 DEFINE_CREATE_AND_THROW_ERROR_FUNC(SyntaxError, SyntaxError, "Syntax error") 123 DEFINE_CREATE_AND_THROW_ERROR_FUNC(SyntaxError, SyntaxError, "Syntax error")
124 DEFINE_CREATE_AND_THROW_ERROR_FUNC(TypeError, TypeError, "Type error") 124 DEFINE_CREATE_AND_THROW_ERROR_FUNC(TypeError, TypeError, "Type error")
125 125
126 #undef DEFINE_CREATE_AND_THROW_ERROR_FUNC 126 #undef DEFINE_CREATE_AND_THROW_ERROR_FUNC
127 127
128 } // namespace blink 128 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698