Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp

Issue 2821443002: Revert of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Revert Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
index 84057d45310b159cafe732267ee4b5028745f885..622c99c70f9b95a57266613a44e9c1b8f540a3a7 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp
@@ -28,13 +28,11 @@
#include "modules/indexeddb/IDBFactory.h"
-#include <memory>
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/modules/v8/V8BindingForModules.h"
#include "core/dom/DOMException.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/ExecutionContext.h"
#include "modules/indexeddb/IDBDatabase.h"
#include "modules/indexeddb/IDBDatabaseCallbacks.h"
#include "modules/indexeddb/IDBKey.h"
@@ -46,6 +44,7 @@
#include "public/platform/WebSecurityOrigin.h"
#include "public/platform/modules/indexeddb/WebIDBDatabaseCallbacks.h"
#include "public/platform/modules/indexeddb/WebIDBFactory.h"
+#include <memory>
namespace blink {
@@ -66,9 +65,9 @@ static bool IsContextValid(ExecutionContext* context) {
IDBRequest* IDBFactory::getDatabaseNames(ScriptState* script_state,
ExceptionState& exception_state) {
IDB_TRACE("IDBFactory::getDatabaseNames");
- if (!IsContextValid(ExecutionContext::From(script_state)))
+ if (!IsContextValid(script_state->GetExecutionContext()))
return nullptr;
- if (!ExecutionContext::From(script_state)
+ if (!script_state->GetExecutionContext()
->GetSecurityOrigin()
->CanAccessDatabase()) {
exception_state.ThrowSecurityError(
@@ -79,8 +78,8 @@ IDBRequest* IDBFactory::getDatabaseNames(ScriptState* script_state,
IDBRequest* request =
IDBRequest::Create(script_state, IDBAny::CreateNull(), nullptr);
- if (!IndexedDBClient::From(ExecutionContext::From(script_state))
- ->AllowIndexedDB(ExecutionContext::From(script_state),
+ if (!IndexedDBClient::From(script_state->GetExecutionContext())
+ ->AllowIndexedDB(script_state->GetExecutionContext(),
"Database Listing")) {
request->OnError(
DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
@@ -90,7 +89,7 @@ IDBRequest* IDBFactory::getDatabaseNames(ScriptState* script_state,
Platform::Current()->IdbFactory()->GetDatabaseNames(
request->CreateWebCallbacks().release(),
WebSecurityOrigin(
- ExecutionContext::From(script_state)->GetSecurityOrigin()));
+ script_state->GetExecutionContext()->GetSecurityOrigin()));
return request;
}
@@ -112,9 +111,9 @@ IDBOpenDBRequest* IDBFactory::OpenInternal(ScriptState* script_state,
ExceptionState& exception_state) {
IDBDatabase::RecordApiCallsHistogram(kIDBOpenCall);
DCHECK(version >= 1 || version == IDBDatabaseMetadata::kNoVersion);
- if (!IsContextValid(ExecutionContext::From(script_state)))
+ if (!IsContextValid(script_state->GetExecutionContext()))
return nullptr;
- if (!ExecutionContext::From(script_state)
+ if (!script_state->GetExecutionContext()
->GetSecurityOrigin()
->CanAccessDatabase()) {
exception_state.ThrowSecurityError(
@@ -127,8 +126,8 @@ IDBOpenDBRequest* IDBFactory::OpenInternal(ScriptState* script_state,
IDBOpenDBRequest* request = IDBOpenDBRequest::Create(
script_state, database_callbacks, transaction_id, version);
- if (!IndexedDBClient::From(ExecutionContext::From(script_state))
- ->AllowIndexedDB(ExecutionContext::From(script_state), name)) {
+ if (!IndexedDBClient::From(script_state->GetExecutionContext())
+ ->AllowIndexedDB(script_state->GetExecutionContext(), name)) {
request->OnError(
DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
return request;
@@ -138,7 +137,7 @@ IDBOpenDBRequest* IDBFactory::OpenInternal(ScriptState* script_state,
name, version, transaction_id, request->CreateWebCallbacks().release(),
database_callbacks->CreateWebCallbacks().release(),
WebSecurityOrigin(
- ExecutionContext::From(script_state)->GetSecurityOrigin()));
+ script_state->GetExecutionContext()->GetSecurityOrigin()));
return request;
}
@@ -172,9 +171,9 @@ IDBOpenDBRequest* IDBFactory::DeleteDatabaseInternal(
bool force_close) {
IDB_TRACE("IDBFactory::deleteDatabase");
IDBDatabase::RecordApiCallsHistogram(kIDBDeleteDatabaseCall);
- if (!IsContextValid(ExecutionContext::From(script_state)))
+ if (!IsContextValid(script_state->GetExecutionContext()))
return nullptr;
- if (!ExecutionContext::From(script_state)
+ if (!script_state->GetExecutionContext()
->GetSecurityOrigin()
->CanAccessDatabase()) {
exception_state.ThrowSecurityError(
@@ -185,8 +184,8 @@ IDBOpenDBRequest* IDBFactory::DeleteDatabaseInternal(
IDBOpenDBRequest* request = IDBOpenDBRequest::Create(
script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion);
- if (!IndexedDBClient::From(ExecutionContext::From(script_state))
- ->AllowIndexedDB(ExecutionContext::From(script_state), name)) {
+ if (!IndexedDBClient::From(script_state->GetExecutionContext())
+ ->AllowIndexedDB(script_state->GetExecutionContext(), name)) {
request->OnError(
DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
return request;
@@ -195,7 +194,7 @@ IDBOpenDBRequest* IDBFactory::DeleteDatabaseInternal(
Platform::Current()->IdbFactory()->DeleteDatabase(
name, request->CreateWebCallbacks().release(),
WebSecurityOrigin(
- ExecutionContext::From(script_state)->GetSecurityOrigin()),
+ script_state->GetExecutionContext()->GetSecurityOrigin()),
force_close);
return request;
}

Powered by Google App Engine
This is Rietveld 408576698