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

Side by Side Diff: third_party/WebKit/Source/modules/quota/StorageManager.cpp

Issue 2812473002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in modules/quota (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/quota/StorageManager.h" 5 #include "modules/quota/StorageManager.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "bindings/modules/v8/V8StorageEstimate.h" 8 #include "bindings/modules/v8/V8StorageEstimate.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 ScriptPromise promise = resolver->Promise(); 65 ScriptPromise promise = resolver->Promise();
66 ExecutionContext* execution_context = script_state->GetExecutionContext(); 66 ExecutionContext* execution_context = script_state->GetExecutionContext();
67 DCHECK(execution_context->IsSecureContext()); // [SecureContext] in IDL 67 DCHECK(execution_context->IsSecureContext()); // [SecureContext] in IDL
68 SecurityOrigin* security_origin = execution_context->GetSecurityOrigin(); 68 SecurityOrigin* security_origin = execution_context->GetSecurityOrigin();
69 if (security_origin->IsUnique()) { 69 if (security_origin->IsUnique()) {
70 resolver->Reject(V8ThrowException::CreateTypeError( 70 resolver->Reject(V8ThrowException::CreateTypeError(
71 script_state->GetIsolate(), kUniqueOriginErrorMessage)); 71 script_state->GetIsolate(), kUniqueOriginErrorMessage));
72 return promise; 72 return promise;
73 } 73 }
74 74
75 ASSERT(execution_context->IsDocument()); 75 DCHECK(execution_context->IsDocument());
76 PermissionService* permission_service = 76 PermissionService* permission_service =
77 GetPermissionService(script_state->GetExecutionContext()); 77 GetPermissionService(script_state->GetExecutionContext());
78 if (!permission_service) { 78 if (!permission_service) {
79 resolver->Reject(DOMException::Create( 79 resolver->Reject(DOMException::Create(
80 kInvalidStateError, 80 kInvalidStateError,
81 "In its current state, the global scope can't request permissions.")); 81 "In its current state, the global scope can't request permissions."));
82 return promise; 82 return promise;
83 } 83 }
84 permission_service->RequestPermission( 84 permission_service->RequestPermission(
85 CreatePermissionDescriptor(PermissionName::DURABLE_STORAGE), 85 CreatePermissionDescriptor(PermissionName::DURABLE_STORAGE),
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 void StorageManager::PermissionRequestComplete(ScriptPromiseResolver* resolver, 160 void StorageManager::PermissionRequestComplete(ScriptPromiseResolver* resolver,
161 PermissionStatus status) { 161 PermissionStatus status) {
162 if (!resolver->GetExecutionContext() || 162 if (!resolver->GetExecutionContext() ||
163 resolver->GetExecutionContext()->IsContextDestroyed()) 163 resolver->GetExecutionContext()->IsContextDestroyed())
164 return; 164 return;
165 resolver->Resolve(status == PermissionStatus::GRANTED); 165 resolver->Resolve(status == PermissionStatus::GRANTED);
166 } 166 }
167 167
168 } // namespace blink 168 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/quota/DeprecatedStorageQuota.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698