OLD | NEW |
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 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 29 matching lines...) Expand all Loading... |
40 #include "modules/webdatabase/Database.h" | 40 #include "modules/webdatabase/Database.h" |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 | 42 |
43 using namespace WTF; | 43 using namespace WTF; |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 void V8SQLTransaction::executeSqlMethodCustom(const v8::FunctionCallbackInfo<v8:
:Value>& args) | 47 void V8SQLTransaction::executeSqlMethodCustom(const v8::FunctionCallbackInfo<v8:
:Value>& args) |
48 { | 48 { |
49 if (!args.Length()) { | 49 if (!args.Length()) { |
50 setDOMException(SYNTAX_ERR, args.GetIsolate()); | 50 setDOMException(SyntaxError, args.GetIsolate()); |
51 return; | 51 return; |
52 } | 52 } |
53 | 53 |
54 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, statement, args[0])
; | 54 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, statement, args[0])
; |
55 | 55 |
56 Vector<SQLValue> sqlValues; | 56 Vector<SQLValue> sqlValues; |
57 | 57 |
58 if (args.Length() > 1 && !isUndefinedOrNull(args[1])) { | 58 if (args.Length() > 1 && !isUndefinedOrNull(args[1])) { |
59 if (!args[1]->IsObject()) { | 59 if (!args[1]->IsObject()) { |
60 setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate()); | 60 setDOMException(TypeMismatchError, args.GetIsolate()); |
61 return; | 61 return; |
62 } | 62 } |
63 | 63 |
64 uint32_t sqlArgsLength = 0; | 64 uint32_t sqlArgsLength = 0; |
65 v8::Local<v8::Object> sqlArgsObject = args[1]->ToObject(); | 65 v8::Local<v8::Object> sqlArgsObject = args[1]->ToObject(); |
66 V8TRYCATCH_VOID(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8::Str
ing::NewSymbol("length"))); | 66 V8TRYCATCH_VOID(v8::Local<v8::Value>, length, sqlArgsObject->Get(v8::Str
ing::NewSymbol("length"))); |
67 | 67 |
68 if (isUndefinedOrNull(length)) | 68 if (isUndefinedOrNull(length)) |
69 sqlArgsLength = sqlArgsObject->GetPropertyNames()->Length(); | 69 sqlArgsLength = sqlArgsObject->GetPropertyNames()->Length(); |
70 else | 70 else |
(...skipping 15 matching lines...) Expand all Loading... |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 SQLTransaction* transaction = V8SQLTransaction::toNative(args.Holder()); | 89 SQLTransaction* transaction = V8SQLTransaction::toNative(args.Holder()); |
90 | 90 |
91 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext()
; | 91 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext()
; |
92 | 92 |
93 RefPtr<SQLStatementCallback> callback; | 93 RefPtr<SQLStatementCallback> callback; |
94 if (args.Length() > 2 && !isUndefinedOrNull(args[2])) { | 94 if (args.Length() > 2 && !isUndefinedOrNull(args[2])) { |
95 if (!args[2]->IsObject()) { | 95 if (!args[2]->IsObject()) { |
96 setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate()); | 96 setDOMException(TypeMismatchError, args.GetIsolate()); |
97 return; | 97 return; |
98 } | 98 } |
99 callback = V8SQLStatementCallback::create(args[2], scriptExecutionContex
t); | 99 callback = V8SQLStatementCallback::create(args[2], scriptExecutionContex
t); |
100 } | 100 } |
101 | 101 |
102 RefPtr<SQLStatementErrorCallback> errorCallback; | 102 RefPtr<SQLStatementErrorCallback> errorCallback; |
103 if (args.Length() > 3 && !isUndefinedOrNull(args[3])) { | 103 if (args.Length() > 3 && !isUndefinedOrNull(args[3])) { |
104 if (!args[3]->IsObject()) { | 104 if (!args[3]->IsObject()) { |
105 setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate()); | 105 setDOMException(TypeMismatchError, args.GetIsolate()); |
106 return; | 106 return; |
107 } | 107 } |
108 errorCallback = V8SQLStatementErrorCallback::create(args[3], scriptExecu
tionContext); | 108 errorCallback = V8SQLStatementErrorCallback::create(args[3], scriptExecu
tionContext); |
109 } | 109 } |
110 | 110 |
111 ExceptionCode ec = 0; | 111 ExceptionCode ec = 0; |
112 transaction->executeSQL(statement, sqlValues, callback, errorCallback, ec); | 112 transaction->executeSQL(statement, sqlValues, callback, errorCallback, ec); |
113 setDOMException(ec, args.GetIsolate()); | 113 setDOMException(ec, args.GetIsolate()); |
114 } | 114 } |
115 | 115 |
116 } // namespace WebCore | 116 } // namespace WebCore |
OLD | NEW |