Changeset 214309 in webkit
- Timestamp:
- Mar 23, 2017 12:06:31 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r214307 r214309 1 2017-03-23 Brady Eidson <beidson@apple.com> 2 3 WebSQL databases should not openable in private browsing. 4 <rdar://problem/30383335> and https://bugs.webkit.org/show_bug.cgi?id=170013 5 6 Reviewed by Alex Christensen. 7 8 * storage/websql/private-browsing-open-disabled-expected.txt: Added. 9 * storage/websql/private-browsing-open-disabled.html: Added. 10 1 11 2017-03-23 Ryan Haddad <ryanhaddad@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r214305 r214309 1 2017-03-23 Brady Eidson <beidson@apple.com> 2 3 WebSQL databases should not openable in private browsing. 4 <rdar://problem/30383335> and https://bugs.webkit.org/show_bug.cgi?id=170013 5 6 Reviewed by Alex Christensen. 7 8 Test: storage/websql/private-browsing-open-disabled.html 9 10 * Modules/webdatabase/DatabaseManager.cpp: 11 (WebCore::DatabaseManager::openDatabaseBackend): 12 (WebCore::DatabaseManager::tryToOpenDatabaseBackend): Throw an exception if in private browsing. 13 * Modules/webdatabase/DatabaseManager.h: 14 1 15 2017-03-22 Dean Jackson <dino@apple.com> 2 16 -
trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
r210292 r214309 122 122 ExceptionOr<Ref<Database>> DatabaseManager::openDatabaseBackend(ScriptExecutionContext& context, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase) 123 123 { 124 auto databaseContext = this->databaseContext(context); 125 126 auto backend = tryToOpenDatabaseBackend(databaseContext, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, FirstTryToOpenDatabase); 124 auto backend = tryToOpenDatabaseBackend(context, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, FirstTryToOpenDatabase); 127 125 128 126 if (backend.hasException()) { … … 134 132 // FIXME: What guarantees context.securityOrigin() is non-null? 135 133 ProposedDatabase proposedDatabase { *this, *context.securityOrigin(), name, displayName, estimatedSize }; 136 databaseContext->databaseExceededQuota(name, proposedDatabase.details());134 this->databaseContext(context)->databaseExceededQuota(name, proposedDatabase.details()); 137 135 } 138 backend = tryToOpenDatabaseBackend( databaseContext, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, RetryOpenDatabase);136 backend = tryToOpenDatabaseBackend(context, name, expectedVersion, displayName, estimatedSize, setVersionInNewDatabase, RetryOpenDatabase); 139 137 } 140 138 } … … 150 148 } 151 149 152 ExceptionOr<Ref<Database>> DatabaseManager::tryToOpenDatabaseBackend( DatabaseContext& backendContext, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase,150 ExceptionOr<Ref<Database>> DatabaseManager::tryToOpenDatabaseBackend(ScriptExecutionContext& scriptContext, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, 153 151 OpenAttempt attempt) 154 152 { 153 if (is<Document>(&scriptContext)) { 154 auto* page = downcast<Document>(scriptContext).page(); 155 if (!page || page->usesEphemeralSession()) 156 return Exception { SECURITY_ERR }; 157 } 158 159 if (scriptContext.isWorkerGlobalScope()) { 160 ASSERT_NOT_REACHED(); 161 return Exception { SECURITY_ERR }; 162 } 163 164 auto backendContext = this->databaseContext(scriptContext); 165 155 166 ExceptionOr<void> preflightResult; 156 167 switch (attempt) { … … 172 183 173 184 // FIXME: What guarantees backendContext.securityOrigin() is non-null? 174 DatabaseTracker::singleton().setDatabaseDetails(backendContext .securityOrigin(), name, displayName, estimatedSize);185 DatabaseTracker::singleton().setDatabaseDetails(backendContext->securityOrigin(), name, displayName, estimatedSize); 175 186 return WTFMove(database); 176 187 } -
trunk/Source/WebCore/Modules/webdatabase/DatabaseManager.h
r208727 r214309 77 77 enum OpenAttempt { FirstTryToOpenDatabase, RetryOpenDatabase }; 78 78 ExceptionOr<Ref<Database>> openDatabaseBackend(ScriptExecutionContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase); 79 static ExceptionOr<Ref<Database>> tryToOpenDatabaseBackend(DatabaseContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, OpenAttempt);79 ExceptionOr<Ref<Database>> tryToOpenDatabaseBackend(ScriptExecutionContext&, const String& name, const String& expectedVersion, const String& displayName, unsigned estimatedSize, bool setVersionInNewDatabase, OpenAttempt); 80 80 81 81 class ProposedDatabase;
Note: See TracChangeset
for help on using the changeset viewer.