OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* ca
llbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const Str
ing& dataDir) | 176 void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* ca
llbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const Str
ing& dataDir) |
177 { | 177 { |
178 #if ENABLE(WORKERS) | 178 #if ENABLE(WORKERS) |
179 WebSecurityOrigin origin(prpOrigin); | 179 WebSecurityOrigin origin(prpOrigin); |
180 if (!allowIDBFromWorkerThread(context, name, origin)) { | 180 if (!allowIDBFromWorkerThread(context, name, origin)) { |
181 callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to
access the database.")); | 181 callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to
access the database.")); |
182 return; | 182 return; |
183 } | 183 } |
184 WorkerLoaderProxy* workerLoaderProxy = &context->thread()->workerLoaderProxy
(); | 184 WorkerLoaderProxy* workerLoaderProxy = &context->thread()->workerLoaderProxy
(); |
185 WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); | 185 WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); |
186 WebFrame* webFrame = webWorker->view()->mainFrame(); | 186 WebView* webView = webWorker->view(); |
| 187 if (!webView) { |
| 188 // Frame is closed, worker is terminaring. |
| 189 return; |
| 190 } |
| 191 WebFrame* webFrame = webView->mainFrame(); |
187 m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webF
rame, dataDir); | 192 m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webF
rame, dataDir); |
188 #endif | 193 #endif |
189 } | 194 } |
190 | 195 |
191 void IDBFactoryBackendProxy::open(const String& name, IDBCallbacks* callbacks, P
assRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) | 196 void IDBFactoryBackendProxy::open(const String& name, IDBCallbacks* callbacks, P
assRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) |
192 { | 197 { |
193 WebSecurityOrigin origin(prpOrigin); | 198 WebSecurityOrigin origin(prpOrigin); |
194 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); | 199 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); |
195 WebViewImpl* webView = webFrame->viewImpl(); | 200 WebViewImpl* webView = webFrame->viewImpl(); |
196 if (webView->permissionClient() && !webView->permissionClient()->allowIndexe
dDB(webFrame, name, origin)) { | 201 if (webView->permissionClient() && !webView->permissionClient()->allowIndexe
dDB(webFrame, name, origin)) { |
(...skipping 13 matching lines...) Expand all Loading... |
210 callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to
access the database.")); | 215 callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to
access the database.")); |
211 return; | 216 return; |
212 } | 217 } |
213 | 218 |
214 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), or
igin, webFrame, dataDir); | 219 m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), or
igin, webFrame, dataDir); |
215 } | 220 } |
216 | 221 |
217 } // namespace WebKit | 222 } // namespace WebKit |
218 | 223 |
219 #endif // ENABLE(INDEXED_DATABASE) | 224 #endif // ENABLE(INDEXED_DATABASE) |
OLD | NEW |