OLD | NEW |
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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 "access to the Indexed Database API is denied in this context."); | 75 "access to the Indexed Database API is denied in this context."); |
76 return nullptr; | 76 return nullptr; |
77 } | 77 } |
78 | 78 |
79 IDBRequest* request = | 79 IDBRequest* request = |
80 IDBRequest::Create(script_state, IDBAny::CreateNull(), nullptr); | 80 IDBRequest::Create(script_state, IDBAny::CreateNull(), nullptr); |
81 | 81 |
82 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) | 82 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) |
83 ->AllowIndexedDB(ExecutionContext::From(script_state), | 83 ->AllowIndexedDB(ExecutionContext::From(script_state), |
84 "Database Listing")) { | 84 "Database Listing")) { |
85 request->EnqueueResponse( | 85 request->HandleResponse( |
86 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); | 86 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); |
87 return request; | 87 return request; |
88 } | 88 } |
89 | 89 |
90 Platform::Current()->IdbFactory()->GetDatabaseNames( | 90 Platform::Current()->IdbFactory()->GetDatabaseNames( |
91 request->CreateWebCallbacks().release(), | 91 request->CreateWebCallbacks().release(), |
92 WebSecurityOrigin( | 92 WebSecurityOrigin( |
93 ExecutionContext::From(script_state)->GetSecurityOrigin())); | 93 ExecutionContext::From(script_state)->GetSecurityOrigin())); |
94 return request; | 94 return request; |
95 } | 95 } |
(...skipping 26 matching lines...) Expand all Loading... |
122 return nullptr; | 122 return nullptr; |
123 } | 123 } |
124 | 124 |
125 IDBDatabaseCallbacks* database_callbacks = IDBDatabaseCallbacks::Create(); | 125 IDBDatabaseCallbacks* database_callbacks = IDBDatabaseCallbacks::Create(); |
126 int64_t transaction_id = IDBDatabase::NextTransactionId(); | 126 int64_t transaction_id = IDBDatabase::NextTransactionId(); |
127 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( | 127 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( |
128 script_state, database_callbacks, transaction_id, version); | 128 script_state, database_callbacks, transaction_id, version); |
129 | 129 |
130 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) | 130 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) |
131 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { | 131 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { |
132 request->EnqueueResponse( | 132 request->HandleResponse( |
133 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); | 133 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); |
134 return request; | 134 return request; |
135 } | 135 } |
136 | 136 |
137 Platform::Current()->IdbFactory()->Open( | 137 Platform::Current()->IdbFactory()->Open( |
138 name, version, transaction_id, request->CreateWebCallbacks().release(), | 138 name, version, transaction_id, request->CreateWebCallbacks().release(), |
139 database_callbacks->CreateWebCallbacks().release(), | 139 database_callbacks->CreateWebCallbacks().release(), |
140 WebSecurityOrigin( | 140 WebSecurityOrigin( |
141 ExecutionContext::From(script_state)->GetSecurityOrigin())); | 141 ExecutionContext::From(script_state)->GetSecurityOrigin())); |
142 return request; | 142 return request; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 exception_state.ThrowSecurityError( | 180 exception_state.ThrowSecurityError( |
181 "access to the Indexed Database API is denied in this context."); | 181 "access to the Indexed Database API is denied in this context."); |
182 return nullptr; | 182 return nullptr; |
183 } | 183 } |
184 | 184 |
185 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( | 185 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( |
186 script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion); | 186 script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion); |
187 | 187 |
188 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) | 188 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) |
189 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { | 189 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { |
190 request->EnqueueResponse( | 190 request->HandleResponse( |
191 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); | 191 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); |
192 return request; | 192 return request; |
193 } | 193 } |
194 | 194 |
195 Platform::Current()->IdbFactory()->DeleteDatabase( | 195 Platform::Current()->IdbFactory()->DeleteDatabase( |
196 name, request->CreateWebCallbacks().release(), | 196 name, request->CreateWebCallbacks().release(), |
197 WebSecurityOrigin( | 197 WebSecurityOrigin( |
198 ExecutionContext::From(script_state)->GetSecurityOrigin()), | 198 ExecutionContext::From(script_state)->GetSecurityOrigin()), |
199 force_close); | 199 force_close); |
200 return request; | 200 return request; |
(...skipping 22 matching lines...) Expand all Loading... |
223 if (!second->IsValid()) { | 223 if (!second->IsValid()) { |
224 exception_state.ThrowDOMException(kDataError, | 224 exception_state.ThrowDOMException(kDataError, |
225 IDBDatabase::kNotValidKeyErrorMessage); | 225 IDBDatabase::kNotValidKeyErrorMessage); |
226 return 0; | 226 return 0; |
227 } | 227 } |
228 | 228 |
229 return static_cast<short>(first->Compare(second)); | 229 return static_cast<short>(first->Compare(second)); |
230 } | 230 } |
231 | 231 |
232 } // namespace blink | 232 } // namespace blink |
OLD | NEW |