Bug 107754

Summary: IndexedDB: Remove IDBUpgradeNeededEvent, merge with IDBVersionChangeEvent
Product: WebKit Reporter: Joshua Bell <jsbell>
Component: New BugsAssignee: Joshua Bell <jsbell>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, dgrogan, michael, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 108044    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Joshua Bell 2013-01-23 15:56:28 PST
IndexedDB: Remove IDBUpgradeNeededEvent, merge with IDBVersionChangeEvent
Comment 1 Joshua Bell 2013-01-24 10:06:46 PST
Created attachment 184522 [details]
Patch
Comment 2 Joshua Bell 2013-01-24 10:07:59 PST
alecflett@ - can you take a look?
Comment 3 Alec Flett 2013-01-24 10:51:54 PST
Comment on attachment 184522 [details]
Patch

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

> Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp:69
> +    RefPtr<IDBAny> oldVersionAny = oldVersion ? IDBAny::create(oldVersion) : IDBAny::createNull();

Isn't there an Invalid Version constant somewhere, so this can be (oldVersion != InvalidVersion) ? IDBAny::create(oldVersion) : IDBAny::createNull() ?

> Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp:70
> +    RefPtr<IDBAny> newVersionAny = m_version ? IDBAny::create(m_version) : IDBAny::createNull();

ditto

> Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp:109
> +    enqueueEvent(IDBVersionChangeEvent::create(IDBAny::create(oldVersion), IDBAny::create(m_version), eventNames().upgradeneededEvent));

this doesn't need the same oldVersion ? ... : null; checks from above?
Comment 4 Joshua Bell 2013-01-24 11:22:54 PST
Comment on attachment 184522 [details]
Patch

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

>> Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp:69
>> +    RefPtr<IDBAny> oldVersionAny = oldVersion ? IDBAny::create(oldVersion) : IDBAny::createNull();
> 
> Isn't there an Invalid Version constant somewhere, so this can be (oldVersion != InvalidVersion) ? IDBAny::create(oldVersion) : IDBAny::createNull() ?

Yeah, I'll switch these to checking against IDBDatabaseMetadata::DefaultIntVersion (which is 0).

>> Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp:109
>> +    enqueueEvent(IDBVersionChangeEvent::create(IDBAny::create(oldVersion), IDBAny::create(m_version), eventNames().upgradeneededEvent));
> 
> this doesn't need the same oldVersion ? ... : null; checks from above?

I didn't change the behavior of upgradeneeded at all, just the interface. So whatever integers were used before will be passed straight through. 

http://crbug.com/153121 captures the issue that when we fire "upgradeneeded" (regardless of the event interface type), the oldVersion is a number. Fixing that requires back-end to front-end plumbing, but is independent of this patch.
Comment 5 Joshua Bell 2013-01-24 12:19:49 PST
Created attachment 184552 [details]
Patch
Comment 6 Joshua Bell 2013-01-24 12:21:11 PST
Created attachment 184553 [details]
Patch
Comment 7 Joshua Bell 2013-01-24 12:21:32 PST
tony@ - can you review?
Comment 8 WebKit Review Bot 2013-01-24 15:45:11 PST
Comment on attachment 184553 [details]
Patch

Clearing flags on attachment: 184553

Committed r140741: <http://trac.webkit.org/changeset/140741>
Comment 9 WebKit Review Bot 2013-01-24 15:45:15 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 WebKit Review Bot 2013-01-27 18:15:26 PST
Re-opened since this is blocked by bug 108044
Comment 11 Joshua Bell 2013-01-28 16:23:58 PST
Relanded as http://trac.webkit.org/changeset/141013