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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 blink::Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksIm
pl::create(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(contex
t->securityOrigin())); | 92 blink::Platform::current()->idbFactory()->getDatabaseNames(WebIDBCallbacksIm
pl::create(request).leakPtr(), createDatabaseIdentifierFromSecurityOrigin(contex
t->securityOrigin())); |
93 return request; | 93 return request; |
94 } | 94 } |
95 | 95 |
96 PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ExecutionContext* context, const S
tring& name, unsigned long long version, ExceptionState& exceptionState) | 96 PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ExecutionContext* context, const S
tring& name, unsigned long long version, ExceptionState& exceptionState) |
97 { | 97 { |
98 IDB_TRACE("IDBFactory::open"); | 98 IDB_TRACE("IDBFactory::open"); |
99 if (!version) { | 99 if (!version) { |
100 exceptionState.throwUninformativeAndGenericTypeError(); | 100 exceptionState.throwTypeError("The version provided must not be 0."); |
101 return 0; | 101 return 0; |
102 } | 102 } |
103 return openInternal(context, name, version, exceptionState); | 103 return openInternal(context, name, version, exceptionState); |
104 } | 104 } |
105 | 105 |
106 PassRefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ExecutionContext* context,
const String& name, int64_t version, ExceptionState& exceptionState) | 106 PassRefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ExecutionContext* context,
const String& name, int64_t version, ExceptionState& exceptionState) |
107 { | 107 { |
108 blink::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEnd
APICalls", IDBOpenCall, IDBMethodsMax); | 108 blink::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEnd
APICalls", IDBOpenCall, IDBMethodsMax); |
109 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion); | 109 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion); |
110 if (name.isNull()) { | 110 if (name.isNull()) { |
111 exceptionState.throwUninformativeAndGenericTypeError(); | 111 exceptionState.throwTypeError("The name provided must not be empty."); |
112 return 0; | 112 return 0; |
113 } | 113 } |
114 if (!isContextValid(context)) | 114 if (!isContextValid(context)) |
115 return 0; | 115 return 0; |
116 if (!context->securityOrigin()->canAccessDatabase()) { | 116 if (!context->securityOrigin()->canAccessDatabase()) { |
117 exceptionState.throwSecurityError("access to the Indexed Database API is
denied in this context."); | 117 exceptionState.throwSecurityError("access to the Indexed Database API is
denied in this context."); |
118 return 0; | 118 return 0; |
119 } | 119 } |
120 | 120 |
121 RefPtr<IDBDatabaseCallbacks> databaseCallbacks = IDBDatabaseCallbacks::creat
e(); | 121 RefPtr<IDBDatabaseCallbacks> databaseCallbacks = IDBDatabaseCallbacks::creat
e(); |
(...skipping 13 matching lines...) Expand all Loading... |
135 { | 135 { |
136 IDB_TRACE("IDBFactory::open"); | 136 IDB_TRACE("IDBFactory::open"); |
137 return openInternal(context, name, IDBDatabaseMetadata::NoIntVersion, except
ionState); | 137 return openInternal(context, name, IDBDatabaseMetadata::NoIntVersion, except
ionState); |
138 } | 138 } |
139 | 139 |
140 PassRefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ExecutionContext* contex
t, const String& name, ExceptionState& exceptionState) | 140 PassRefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ExecutionContext* contex
t, const String& name, ExceptionState& exceptionState) |
141 { | 141 { |
142 IDB_TRACE("IDBFactory::deleteDatabase"); | 142 IDB_TRACE("IDBFactory::deleteDatabase"); |
143 blink::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEnd
APICalls", IDBDeleteDatabaseCall, IDBMethodsMax); | 143 blink::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEnd
APICalls", IDBDeleteDatabaseCall, IDBMethodsMax); |
144 if (name.isNull()) { | 144 if (name.isNull()) { |
145 exceptionState.throwUninformativeAndGenericTypeError(); | 145 exceptionState.throwTypeError("The name provided must not be empty."); |
146 return 0; | 146 return 0; |
147 } | 147 } |
148 if (!isContextValid(context)) | 148 if (!isContextValid(context)) |
149 return 0; | 149 return 0; |
150 if (!context->securityOrigin()->canAccessDatabase()) { | 150 if (!context->securityOrigin()->canAccessDatabase()) { |
151 exceptionState.throwSecurityError("access to the Indexed Database API is
denied in this context."); | 151 exceptionState.throwSecurityError("access to the Indexed Database API is
denied in this context."); |
152 return 0; | 152 return 0; |
153 } | 153 } |
154 | 154 |
155 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(context, 0, 0, I
DBDatabaseMetadata::DefaultIntVersion); | 155 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(context, 0, 0, I
DBDatabaseMetadata::DefaultIntVersion); |
(...skipping 18 matching lines...) Expand all Loading... |
174 | 174 |
175 if (!first->isValid() || !second->isValid()) { | 175 if (!first->isValid() || !second->isValid()) { |
176 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); | 176 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); |
177 return 0; | 177 return 0; |
178 } | 178 } |
179 | 179 |
180 return static_cast<short>(first->compare(second.get())); | 180 return static_cast<short>(first->compare(second.get())); |
181 } | 181 } |
182 | 182 |
183 } // namespace WebCore | 183 } // namespace WebCore |
OLD | NEW |