Bug 135440

Summary: IDB versionchange event not constructed with proper eventType
Product: WebKit Reporter: Vicki Pfau <jeffrey+webkit>
Component: WebCore Misc.Assignee: Vicki Pfau <jeffrey+webkit>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: alecflett, buildbot, commit-queue, jsbell, psolanki, rniwa
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
darin: review-, buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 none

Description Vicki Pfau 2014-07-30 16:56:07 PDT
When constructing a versionchange event in IDBDatabase::onVersionChange, the event is not constructed with a proper eventType, giving it a null event type.

<rdar://problem/17394855>
Comment 1 Vicki Pfau 2014-07-30 17:41:07 PDT
Created attachment 235785 [details]
Patch
Comment 2 Pratik Solanki 2014-07-30 17:56:50 PDT
Comment on attachment 235785 [details]
Patch

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

> Source/WebCore/Modules/indexeddb/IDBDatabase.cpp:311
> +    enqueueEvent(IDBVersionChangeEvent::create(oldVersion, newVersion, newVersionNullness, eventNames().versionchangeEvent));

We should just make IDBVersionChangeEvent::create() pass the correct event name instead of having callers pass it. See for example EventFactory::create() which has

#if ENABLE(INDEXED_DATABASE)
    if (type == "IDBVersionChangeEvent")
        return IDBVersionChangeEvent::create();
#endif

That would also create an event with no name.
Comment 3 Build Bot 2014-07-30 19:43:50 PDT
Comment on attachment 235785 [details]
Patch

Attachment 235785 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5219620243898368

New failing tests:
media/track/add-and-remove-track.html
Comment 4 Build Bot 2014-07-30 19:43:52 PDT
Created attachment 235802 [details]
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-12  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 5 Darin Adler 2014-08-19 09:36:13 PDT
Comment on attachment 235785 [details]
Patch

Setting review- so we can do what Pratik suggested.
Comment 6 Vicki Pfau 2014-08-19 14:07:35 PDT
The reason I hadn't done that yet it because some of the invocations of the constructor pass different event names. Which itself is weird and probably bad. I can have it have a sane default argument though, instead of just being null.
Comment 7 Pratik Solanki 2014-08-20 09:49:41 PDT
I think we should just remove the default arg and have it be one that callers are forced to pass. Make it the first argument of the create method and the constructor. Something like the following.

-    static PassRefPtr<IDBVersionChangeEvent> create(unsigned long long oldVersion = 0, unsigned long long newVersion = 0, IndexedDB::VersionNullness newVersionNullness = IndexedDB::VersionNullness::Null, const AtomicString& eventType = AtomicString())
+    static PassRefPtr<IDBVersionChangeEvent> create(const AtomicString& eventType, unsigned long long oldVersion = 0, unsigned long long newVersion = 0, IndexedDB::VersionNullness newVersionNullness = IndexedDB::VersionNullness::Null)
Comment 8 Vicki Pfau 2014-09-05 15:16:01 PDT
A patch identical to the r-'d patch here (minus tests) was landed with bug #136583.

*** This bug has been marked as a duplicate of bug 136583 ***