RESOLVED FIXED 92560
IndexedDB: integer version layout tests
https://bugs.webkit.org/show_bug.cgi?id=92560
Summary IndexedDB: integer version layout tests
David Grogan
Reported 2012-07-27 16:29:38 PDT
IndexedDB: integer version layout tests
Attachments
Patch (44.19 KB, patch)
2012-07-27 16:30 PDT, David Grogan
no flags
Patch (44.43 KB, patch)
2012-07-27 16:34 PDT, David Grogan
no flags
Patch (44.33 KB, patch)
2012-07-27 16:39 PDT, David Grogan
no flags
Patch (54.32 KB, patch)
2012-07-30 13:03 PDT, David Grogan
no flags
Patch (54.32 KB, patch)
2012-07-30 14:14 PDT, David Grogan
no flags
Patch (77.54 KB, patch)
2012-07-31 13:26 PDT, David Grogan
no flags
Patch (66.98 KB, patch)
2012-07-31 13:31 PDT, David Grogan
no flags
Patch (67.02 KB, patch)
2012-07-31 16:12 PDT, David Grogan
no flags
Patch (66.92 KB, patch)
2012-07-31 16:35 PDT, David Grogan
no flags
Patch for landing (66.93 KB, patch)
2012-08-01 14:28 PDT, David Grogan
no flags
David Grogan
Comment 1 2012-07-27 16:30:06 PDT
David Grogan
Comment 2 2012-07-27 16:34:22 PDT
David Grogan
Comment 3 2012-07-27 16:39:45 PDT
David Grogan
Comment 4 2012-07-27 16:41:13 PDT
Josh and Alec, could you take a look at this?
Joshua Bell
Comment 5 2012-07-29 19:44:54 PDT
Comment on attachment 155088 [details] Patch Didn't finish going through, but initial feedback. View in context: https://bugs.webkit.org/attachment.cgi?id=155088&action=review > LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js:11 > + dbname = self.location.pathname.substring(1 + self.location.pathname.lastIndexOf("/")); This is getting a bit long to type and fragile to copy/paste, how about a helper in shared.js, e.g. setDBNameFromTestPath() ? It could log something pretty to the output. > LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js:21 > + request.onupgradeneeded = upgradeNeeded; Add onblocked handler? (Your suggestion elsewhere - I think we want to do that in general going forward so we get TEXT fail w/ diff rather than TIMEOUT.) Ditto for the other tests. > LayoutTests/storage/indexeddb/resources/intversion-and-setversion.js:49 > + db = trans.db; Is this line needed? > LayoutTests/storage/indexeddb/resources/intversion-and-setversion.js:59 > + db = event.target.db; Or this one? If I understand things correctly, db should have remained the same object the whole time. > LayoutTests/storage/indexeddb/resources/intversion-blocked.js:25 > + event = evt; Should be indented 2 more spaces. > LayoutTests/storage/indexeddb/resources/intversion-blocked.js:71 > + evalAndLog("gotBlockedEvent = true"); I don't know if we do anywhere else, but in one of these tests it wouldn't hurt to say: shouldBe("event.target", "connection1"); > LayoutTests/storage/indexeddb/resources/intversion-close-between-events.js:37 > + transaction.oncomplete = function(e) In other tests, we don't include the e parameter if not used, and { on the same line as function keyword for anonymous functions. I'm not sure we're totally consistent, though. > LayoutTests/storage/indexeddb/resources/intversion-close-between-events.js:56 > +function openSuccess(evt) Do we know what the state of db should be here? To test if db is closed we can call db.transaction() on it (it will raise if db is closed). > LayoutTests/storage/indexeddb/resources/intversion-close-between-events.js:66 > + finishJSTest(); Should be indented two more spaces. > LayoutTests/storage/indexeddb/resources/intversion-close-in-oncomplete.js:33 > + evalAndLog("db.createObjectStore(\"os\")"); For readability, use single quotes instead of escaped quotes?
Joshua Bell
Comment 6 2012-07-29 20:34:54 PDT
Comment on attachment 155088 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155088&action=review > LayoutTests/storage/indexeddb/resources/intversion-high-version-first.js:6 > +description("Test that if two open requests are waiting at the same time, the one with the higher version gets called first"); Wow... the consequences of this are non-intuitive! > LayoutTests/storage/indexeddb/resources/intversion-high-version-first.js:45 > + request2.onsuccess = successCallback2; ... so 2 succeeds because 1 closes promptly, but 3 and 4 get queued and 4 wins, 3 is blocked? I would have expected that all 3 are treated equally, 4 wins, and 2 and 3 get VersionError. > LayoutTests/storage/indexeddb/resources/intversion-open-with-version.js:26 > + shouldBeEqualToString("Object.prototype.toString.apply(request)", "[object IDBOpenDBRequest]"); Other tests use String(foo) rather than the ...apply() call. While I'm a pedantic fan of the latter, the former is easier to read. :)
David Grogan
Comment 7 2012-07-30 12:28:46 PDT
Comment on attachment 155088 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=155088&action=review >> LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js:11 >> + dbname = self.location.pathname.substring(1 + self.location.pathname.lastIndexOf("/")); > > This is getting a bit long to type and fragile to copy/paste, how about a helper in shared.js, e.g. setDBNameFromTestPath() ? It could log something pretty to the output. Added. Also added preamble() to shared.js. >> LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js:21 >> + request.onupgradeneeded = upgradeNeeded; > > Add onblocked handler? (Your suggestion elsewhere - I think we want to do that in general going forward so we get TEXT fail w/ diff rather than TIMEOUT.) > > Ditto for the other tests. Done, I think everywhere. >> LayoutTests/storage/indexeddb/resources/intversion-and-setversion.js:49 >> + db = trans.db; > > Is this line needed? Not strictly needed, but I like to retrieve all the genericly named objects in the function so as to be resilient against changes in the other earlier function. If I intend to reuse an object later in a different function I try to either declare it in the global scope or give it an explicit name, a la connection1. What do you do? >> LayoutTests/storage/indexeddb/resources/intversion-blocked.js:25 >> + event = evt; > > Should be indented 2 more spaces. Moved to new function. >> LayoutTests/storage/indexeddb/resources/intversion-blocked.js:71 >> + evalAndLog("gotBlockedEvent = true"); > > I don't know if we do anywhere else, but in one of these tests it wouldn't hurt to say: shouldBe("event.target", "connection1"); Added to versionChangeHandler above. >> LayoutTests/storage/indexeddb/resources/intversion-close-between-events.js:37 >> + transaction.oncomplete = function(e) > > In other tests, we don't include the e parameter if not used, and { on the same line as function keyword for anonymous functions. I'm not sure we're totally consistent, though. Fixed. >> LayoutTests/storage/indexeddb/resources/intversion-close-between-events.js:56 >> +function openSuccess(evt) > > Do we know what the state of db should be here? To test if db is closed we can call db.transaction() on it (it will raise if db is closed). It should be open, since db.close hasn't been called yet. Added a transaction line. >> LayoutTests/storage/indexeddb/resources/intversion-close-between-events.js:66 >> + finishJSTest(); > > Should be indented two more spaces. Thanks. I need to get vim to autoindent 4 spaces if the file matches third_party/WebKit. >> LayoutTests/storage/indexeddb/resources/intversion-close-in-oncomplete.js:33 >> + evalAndLog("db.createObjectStore(\"os\")"); > > For readability, use single quotes instead of escaped quotes? Done. >> LayoutTests/storage/indexeddb/resources/intversion-high-version-first.js:6 >> +description("Test that if two open requests are waiting at the same time, the one with the higher version gets called first"); > > Wow... the consequences of this are non-intuitive! Yeah, I'm not sure I'm reading the spec correctly either. It could use some clarification on this point. I intend to file a bug. >> LayoutTests/storage/indexeddb/resources/intversion-high-version-first.js:45 >> + request2.onsuccess = successCallback2; > > ... so 2 succeeds because 1 closes promptly, but 3 and 4 get queued and 4 wins, 3 is blocked? > > I would have expected that all 3 are treated equally, 4 wins, and 2 and 3 get VersionError. Now that I'm re-reading this, I feel like you're right. Either way, we don't do it right yet. Firefox fires upgradeneeded at 2 then 3 then 4, so I don't think they have figured it out either. >> LayoutTests/storage/indexeddb/resources/intversion-open-with-version.js:26 >> + shouldBeEqualToString("Object.prototype.toString.apply(request)", "[object IDBOpenDBRequest]"); > > Other tests use String(foo) rather than the ...apply() call. While I'm a pedantic fan of the latter, the former is easier to read. :) Ah yes, I switched to String(foo) halfway through these tests.
David Grogan
Comment 8 2012-07-30 13:03:25 PDT
David Grogan
Comment 9 2012-07-30 14:14:19 PDT
David Grogan
Comment 10 2012-07-31 13:26:10 PDT
David Grogan
Comment 11 2012-07-31 13:31:51 PDT
David Grogan
Comment 12 2012-07-31 13:33:27 PDT
Removed intversion-high-version-first (for now) because it causes the new code to permanently stay in m_runningVersionChangeTransaction, causing the next test to timeout.
David Grogan
Comment 13 2012-07-31 16:12:45 PDT
David Grogan
Comment 14 2012-07-31 16:35:58 PDT
David Grogan
Comment 15 2012-07-31 18:38:03 PDT
Tony, could you review this? I'm going to land a series of patches in the coming days (hopefully by friday!) that will enable some of this functionality incrementally. It'd be nice to land these all at once and then just include updated expected files with the code as necessary. Josh didn't LGTM here but he did say it looked good in an offline thread.
David Grogan
Comment 16 2012-08-01 11:26:08 PDT
Nate, Tony, our usual reviewer, is OOO the next couple of days. Could you review this?
David Grogan
Comment 17 2012-08-01 14:28:45 PDT
Created attachment 155885 [details] Patch for landing
WebKit Review Bot
Comment 18 2012-08-01 16:27:30 PDT
Comment on attachment 155885 [details] Patch for landing Clearing flags on attachment: 155885 Committed r124383: <http://trac.webkit.org/changeset/124383>
WebKit Review Bot
Comment 19 2012-08-01 16:27:34 PDT
All reviewed patches have been landed. Closing bug.
David Grogan
Comment 20 2012-08-21 15:26:28 PDT
*** Bug 84309 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.