Changeset 60754
- Timestamp:
- 06/05/10 13:19:21 (5 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
bindings/scripts/CodeGeneratorV8.pm (modified) (2 diffs)
-
bindings/scripts/test/V8/V8TestCallback.cpp (modified) (3 diffs)
-
bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r60753 r60754 1 2010-05-28 Dumitru Daniliuc <dumi@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Do not pass empty handles to v8. 6 https://bugs.webkit.org/show_bug.cgi?id=39896 7 8 Passing an empty handle to v8 results in a crash with a stack 9 trace that doesn't give us much information about the cause of the 10 crash. Instead, if we check the handles we pass to v8 and crash 11 when they are empty, we do not make things worse, and should get a 12 more informative stack trace. 13 14 * bindings/scripts/CodeGeneratorV8.pm: 15 * bindings/scripts/test/V8/V8TestCallback.cpp: 16 (WebCore::V8TestCallback::callbackWithClass1Param): 17 (WebCore::V8TestCallback::callbackWithClass2Param): 18 * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: 19 (WebCore::V8SQLStatementErrorCallback::handleEvent): 20 1 21 2010-05-30 Antonio Gomes <tonikitoo@webkit.org> 2 22 -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r60670 r60754 2237 2237 $implIncludes{"V8CustomVoidCallback.h"} = 1; 2238 2238 2239 push(@implContent, "#include <wtf/Assertions.h>\n\n"); 2239 2240 push(@implContent, "namespace WebCore {\n\n"); 2240 2241 push(@implContent, <<END); … … 2278 2279 push(@implContent, " return true;\n\n"); 2279 2280 push(@implContent, " v8::Context::Scope scope(v8Context);\n\n"); 2280 push(@implContent, " v8::Handle<v8::Value> argv[] = {\n");2281 2281 2282 2282 my @argvs = (); 2283 2283 foreach my $param (@params) { 2284 2284 my $paramName = $param->name; 2285 push(@argvs, " toV8(${paramName})"); 2285 push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = toV8(${paramName});\n"); 2286 push(@implContent, " if (${paramName}Handle.IsEmpty()) {\n"); 2287 push(@implContent, " CRASH();\n"); 2288 push(@implContent, " return true;\n"); 2289 push(@implContent, " }\n"); 2290 push(@argvs, " ${paramName}Handle"); 2286 2291 } 2292 2293 push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n"); 2287 2294 push(@implContent, join(",\n", @argvs)); 2288 2289 2295 push(@implContent, "\n };\n\n"); 2290 2296 push(@implContent, " bool callbackReturnValue = false;\n"); -
trunk/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
r60330 r60754 30 30 #include "V8DOMString.h" 31 31 32 #include <wtf/Assertions.h> 33 32 34 namespace WebCore { 33 35 … … 55 57 v8::Context::Scope scope(v8Context); 56 58 59 v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param); 60 if (class1ParamHandle.IsEmpty()) { 61 CRASH(); 62 return true; 63 } 64 57 65 v8::Handle<v8::Value> argv[] = { 58 toV8(class1Param)66 class1ParamHandle 59 67 }; 60 68 … … 73 81 v8::Context::Scope scope(v8Context); 74 82 83 v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param); 84 if (class2ParamHandle.IsEmpty()) { 85 CRASH(); 86 return true; 87 } 88 v8::Handle<v8::Value> strArgHandle = toV8(strArg); 89 if (strArgHandle.IsEmpty()) { 90 CRASH(); 91 return true; 92 } 93 75 94 v8::Handle<v8::Value> argv[] = { 76 toV8(class2Param),77 toV8(strArg)95 class2ParamHandle, 96 strArgHandle 78 97 }; 79 98 -
trunk/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
r60330 r60754 40 40 #include "V8SQLError.h" 41 41 #include "V8SQLTransaction.h" 42 #include <wtf/Assertions.h> 42 43 43 44 namespace WebCore { … … 53 54 v8::Context::Scope scope(v8Context); 54 55 56 v8::Handle<v8::Value> transactionHandle = toV8(transaction); 57 v8::Handle<v8::Value> errorHandle = toV8(error); 58 if (transactionHandle.IsEmpty() || errorHandle.isEmpty()) { 59 CRASH(); 60 return true; 61 } 62 55 63 v8::Handle<v8::Value> argv[] = { 56 t oV8(transaction),57 toV8(error)64 transactionHandle, 65 errorHandle 58 66 }; 59 67
Note: See TracChangeset
for help on using the changeset viewer.