| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 DCHECK(context->IsDocument() || context->IsWorkerGlobalScope()); | 58 DCHECK(context->IsDocument() || context->IsWorkerGlobalScope()); |
| 59 if (context->IsDocument()) { | 59 if (context->IsDocument()) { |
| 60 Document* document = ToDocument(context); | 60 Document* document = ToDocument(context); |
| 61 return document->GetFrame() && document->GetPage(); | 61 return document->GetFrame() && document->GetPage(); |
| 62 } | 62 } |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 IDBRequest* IDBFactory::GetDatabaseNames(ScriptState* script_state, | 66 IDBRequest* IDBFactory::GetDatabaseNames(ScriptState* script_state, |
| 67 ExceptionState& exception_state) { | 67 ExceptionState& exception_state) { |
| 68 IDB_TRACE("IDBFactory::getDatabaseNamesRequestSetup"); |
| 69 IDBRequest::AsyncTraceState metrics("IDBFactory::getDatabaseNames", this); |
| 70 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::CreateNull(), |
| 71 nullptr, std::move(metrics)); |
| 68 // TODO(jsbell): Used only by inspector; remove unneeded checks/exceptions? | 72 // TODO(jsbell): Used only by inspector; remove unneeded checks/exceptions? |
| 69 if (!IsContextValid(ExecutionContext::From(script_state))) | 73 if (!IsContextValid(ExecutionContext::From(script_state))) |
| 70 return nullptr; | 74 return nullptr; |
| 71 if (!ExecutionContext::From(script_state) | 75 if (!ExecutionContext::From(script_state) |
| 72 ->GetSecurityOrigin() | 76 ->GetSecurityOrigin() |
| 73 ->CanAccessDatabase()) { | 77 ->CanAccessDatabase()) { |
| 74 exception_state.ThrowSecurityError( | 78 exception_state.ThrowSecurityError( |
| 75 "access to the Indexed Database API is denied in this context."); | 79 "access to the Indexed Database API is denied in this context."); |
| 76 return nullptr; | 80 return nullptr; |
| 77 } | 81 } |
| 78 | 82 |
| 79 IDBRequest* request = | |
| 80 IDBRequest::Create(script_state, IDBAny::CreateNull(), nullptr); | |
| 81 | |
| 82 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) | 83 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) |
| 83 ->AllowIndexedDB(ExecutionContext::From(script_state), | 84 ->AllowIndexedDB(ExecutionContext::From(script_state), |
| 84 "Database Listing")) { | 85 "Database Listing")) { |
| 85 request->HandleResponse( | 86 request->HandleResponse( |
| 86 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); | 87 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); |
| 87 return request; | 88 return request; |
| 88 } | 89 } |
| 89 | 90 |
| 90 Platform::Current()->IdbFactory()->GetDatabaseNames( | 91 Platform::Current()->IdbFactory()->GetDatabaseNames( |
| 91 request->CreateWebCallbacks().release(), | 92 request->CreateWebCallbacks().release(), |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (!second->IsValid()) { | 225 if (!second->IsValid()) { |
| 225 exception_state.ThrowDOMException(kDataError, | 226 exception_state.ThrowDOMException(kDataError, |
| 226 IDBDatabase::kNotValidKeyErrorMessage); | 227 IDBDatabase::kNotValidKeyErrorMessage); |
| 227 return 0; | 228 return 0; |
| 228 } | 229 } |
| 229 | 230 |
| 230 return static_cast<short>(first->Compare(second)); | 231 return static_cast<short>(first->Compare(second)); |
| 231 } | 232 } |
| 232 | 233 |
| 233 } // namespace blink | 234 } // namespace blink |
| OLD | NEW |