| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 IndexedDBClient* IndexedDBClientImpl::create() { | 44 IndexedDBClient* IndexedDBClientImpl::create() { |
| 45 return new IndexedDBClientImpl(); | 45 return new IndexedDBClientImpl(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool IndexedDBClientImpl::allowIndexedDB(ExecutionContext* context, | 48 bool IndexedDBClientImpl::allowIndexedDB(ExecutionContext* context, |
| 49 const String& name) { | 49 const String& name) { |
| 50 DCHECK(context->isContextThread()); | 50 DCHECK(context->isContextThread()); |
| 51 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument() || | 51 SECURITY_DCHECK(context->isDocument() || context->isWorkerGlobalScope()); |
| 52 context->isWorkerGlobalScope()); | |
| 53 | 52 |
| 54 if (context->isDocument()) { | 53 if (context->isDocument()) { |
| 55 WebSecurityOrigin origin(context->getSecurityOrigin()); | 54 WebSecurityOrigin origin(context->getSecurityOrigin()); |
| 56 Document* document = toDocument(context); | 55 Document* document = toDocument(context); |
| 57 WebLocalFrameImpl* webFrame = | 56 WebLocalFrameImpl* webFrame = |
| 58 WebLocalFrameImpl::fromFrame(document->frame()); | 57 WebLocalFrameImpl::fromFrame(document->frame()); |
| 59 if (!webFrame) | 58 if (!webFrame) |
| 60 return false; | 59 return false; |
| 61 if (webFrame->contentSettingsClient()) | 60 if (webFrame->contentSettingsClient()) |
| 62 return webFrame->contentSettingsClient()->allowIndexedDB(name, origin); | 61 return webFrame->contentSettingsClient()->allowIndexedDB(name, origin); |
| 63 return true; | 62 return true; |
| 64 } | 63 } |
| 65 | 64 |
| 66 WorkerGlobalScope& workerGlobalScope = *toWorkerGlobalScope(context); | 65 WorkerGlobalScope& workerGlobalScope = *toWorkerGlobalScope(context); |
| 67 return WorkerContentSettingsClient::from(workerGlobalScope) | 66 return WorkerContentSettingsClient::from(workerGlobalScope) |
| 68 ->allowIndexedDB(name); | 67 ->allowIndexedDB(name); |
| 69 } | 68 } |
| 70 | 69 |
| 71 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |