Bug 128060

Summary: IDB: Support IDBFactory.deleteDatabase()
Product: WebKit Reporter: Jon Lee <jonlee>
Component: WebCore Misc.Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, commit-queue, jsbell, mjs, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 124521    
Attachments:
Description Flags
Patch v1 fpizlo: review+

Description Jon Lee 2014-02-01 19:57:43 PST
Required for running layout tests.

<rdar://problem/15965021>
Comment 1 Brady Eidson 2014-02-02 01:09:20 PST
Created attachment 222918 [details]
Patch v1

Touches the filesystem (delete), so requires extra scrutiny.
Comment 2 WebKit Commit Bot 2014-02-02 01:11:04 PST
Attachment 222918 [details] did not pass style-queue:


ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:202:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:44:  Missing space after ,  [whitespace/comma] [3]
Total errors found: 2 in 17 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Filip Pizlo 2014-02-02 10:21:39 PST
Comment on attachment 222918 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=222918&action=review

r=me

> Source/WebCore/Modules/indexeddb/IDBFactory.cpp:164
> -    m_backend->deleteDatabase(name, request, context->securityOrigin(), context, getIndexedDBDatabasePath(context));
> +    m_backend->deleteDatabase(name, *(context->securityOrigin()), *(context->topOrigin()), request, context, getIndexedDBDatabasePath(context));

It feels like instead of *(context->securityOrigin()), you could just say *context->securityOrigin().  The extra parens make me initially expect something sneaky to be going on even though it's pretty straight-forward.
Comment 4 Simon Fraser (smfr) 2014-02-02 10:40:00 PST
Comment on attachment 222918 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=222918&action=review

Count me as a pair of eyes.

> Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp:558
> -void IDBDatabaseBackend::deleteDatabaseAsync(PassRefPtr<IDBCallbacks> callbacks)
> +void IDBDatabaseBackend::deleteDatabaseAsync(PassRefPtr<IDBCallbacks> prpCallbacks)

Hungarian notation!?

> Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:166
> +        LOG(IDB, "UniqueIDBDatabase::shutdownBackingStore would deleting file '%s' on disk", dbFilename.utf8().data());

would deleting file?
Comment 5 Timothy Hatcher 2014-02-02 10:49:51 PST
Comment on attachment 222918 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=222918&action=review

>> Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp:558
>> +void IDBDatabaseBackend::deleteDatabaseAsync(PassRefPtr<IDBCallbacks> prpCallbacks)
> 
> Hungarian notation!?

It is the sanctioned prefix for PassRefPtr when you want to put it into a RefPtr in the function. http://www.webkit.org/coding/RefPtr.html
Comment 6 Brady Eidson 2014-02-02 11:21:23 PST
(In reply to comment #4)
> (From update of attachment 222918 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=222918&action=review
> 
> Count me as a pair of eyes.
> 
> > Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp:558
> > -void IDBDatabaseBackend::deleteDatabaseAsync(PassRefPtr<IDBCallbacks> callbacks)
> > +void IDBDatabaseBackend::deleteDatabaseAsync(PassRefPtr<IDBCallbacks> prpCallbacks)
> 
> Hungarian notation!?

Tim already pointed out this is the PassRefPtr standard.


> > Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:166
> > +        LOG(IDB, "UniqueIDBDatabase::shutdownBackingStore would deleting file '%s' on disk", dbFilename.utf8().data());
> 
> would deleting file?

Yikes.  Thanks!

(In reply to comment #3)

> > Source/WebCore/Modules/indexeddb/IDBFactory.cpp:164
> > -    m_backend->deleteDatabase(name, request, context->securityOrigin(), context, getIndexedDBDatabasePath(context));
> > +    m_backend->deleteDatabase(name, *(context->securityOrigin()), *(context->topOrigin()), request, context, getIndexedDBDatabasePath(context));
> 
> It feels like instead of *(context->securityOrigin()), you could just say *context->securityOrigin().  The extra parens make me initially expect something sneaky to be going on even though it's pretty straight-forward.

You're right.  Thanks!
Comment 7 Maciej Stachowiak 2014-02-02 11:31:01 PST
(In reply to comment #5)
> (From update of attachment 222918 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=222918&action=review
> 
> >> Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp:558
> >> +void IDBDatabaseBackend::deleteDatabaseAsync(PassRefPtr<IDBCallbacks> prpCallbacks)
> > 
> > Hungarian notation!?
> 
> It is the sanctioned prefix for PassRefPtr when you want to put it into a RefPtr in the function. http://www.webkit.org/coding/RefPtr.html

What a weird choice. I get the desire to distinguish the name from the actually used one, but I'd use something like "passCallbacks" or "callbacksParam" or "callbacksArg" to make this clear. I will have to ask Darin why he used "prp" in the RefPtr guide.
Comment 8 Maciej Stachowiak 2014-02-02 11:42:23 PST
Comment on attachment 222918 [details]
Patch v1

I don't see any issues besides those spotted by others. r=me
Comment 9 Brady Eidson 2014-02-02 11:51:32 PST
http://trac.webkit.org/changeset/163266