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

Side by Side Diff: Source/bindings/v8/V8BindingMacros.h

Issue 313033002: Rethrow exception when swallowing it is not intended. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 { \ 64 { \
65 v8::TryCatch block; \ 65 v8::TryCatch block; \
66 var = (value); \ 66 var = (value); \
67 if (UNLIKELY(block.HasCaught())) { \ 67 if (UNLIKELY(block.HasCaught())) { \
68 block.ReThrow(); \ 68 block.ReThrow(); \
69 return retVal; \ 69 return retVal; \
70 } \ 70 } \
71 } 71 }
72 72
73 #define TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState) \ 73 #define TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState) \
74 var = (value); \ 74 var = (value); \
75 if (UNLIKELY(block.HasCaught())) \ 75 if (UNLIKELY(block.HasCaught() || exceptionState.throwIfNeeded())) \
76 exceptionState.rethrowV8Exception(block.Exception()); \ 76 return; \
77 if (UNLIKELY(exceptionState.throwIfNeeded())) \
78 return;
79 77
80 #define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \ 78 #define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \
81 type var; \ 79 type var; \
82 { \ 80 { \
83 v8::TryCatch block; \ 81 v8::TryCatch block; \
82 V8RethrowTryCatchScope rethrow(block); \
84 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \ 83 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \
85 } 84 }
86 85
87 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal ) \ 86 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal ) \
88 type var; \ 87 type var; \
89 { \ 88 { \
90 v8::TryCatch block; \ 89 v8::TryCatch block; \
91 var = (value); \ 90 V8RethrowTryCatchScope rethrow(block); \
92 if (UNLIKELY(block.HasCaught())) \ 91 var = (value); \
93 exceptionState.rethrowV8Exception(block.Exception()); \ 92 if (UNLIKELY(block.HasCaught() || exceptionState.throwIfNeeded())) \
94 if (UNLIKELY(exceptionState.throwIfNeeded())) \ 93 return retVal; \
95 return retVal; \
96 } 94 }
97 95
98 // type is an instance of class template V8StringResource<>, 96 // type is an instance of class template V8StringResource<>,
99 // but Mode argument varies; using type (not Mode) for consistency 97 // but Mode argument varies; using type (not Mode) for consistency
100 // with other macros and ease of code generation 98 // with other macros and ease of code generation
101 #define TOSTRING_VOID(type, var, value) \ 99 #define TOSTRING_VOID(type, var, value) \
102 type var(value); \ 100 type var(value); \
103 if (UNLIKELY(!var.prepare())) \ 101 if (UNLIKELY(!var.prepare())) \
104 return; 102 return;
105 103
106 #define TOSTRING_VOID_INTERNAL(var, value) \ 104 #define TOSTRING_VOID_INTERNAL(var, value) \
107 var = (value); \ 105 var = (value); \
108 if (UNLIKELY(!var.prepare())) \ 106 if (UNLIKELY(!var.prepare())) \
109 return; 107 return;
110 108
111 #define TOSTRING_DEFAULT(type, var, value, retVal) \ 109 #define TOSTRING_DEFAULT(type, var, value, retVal) \
112 type var(value); \ 110 type var(value); \
113 if (UNLIKELY(!var.prepare())) \ 111 if (UNLIKELY(!var.prepare())) \
114 return retVal; 112 return retVal;
115 113
116 } // namespace WebCore 114 } // namespace WebCore
117 115
118 #endif // V8BindingMacros_h 116 #endif // V8BindingMacros_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/TreeWalker/acceptNode-filter-expected.txt ('k') | Source/bindings/v8/V8NodeFilterCondition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698