Bug 136155 - indexeddb versionchange event not fired
Summary: indexeddb versionchange event not fired
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://jsbin.com/velolu/1/quiet
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-08-22 06:20 PDT by Jake Archibald
Modified: 2016-03-30 11:37 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jake Archibald 2014-08-22 06:20:32 PDT
Visit http://jsbin.com/velolu/1/quiet
Open http://jsbin.com/pucegu/1/quiet in another tab
First tab should have versionchange event (compare to Firefox & Chrome).

Also getting some weird "unknownerror"s if I run this test a few times.
Comment 1 Raymond Camden 2014-09-26 07:20:17 PDT
I can confirm this is a bug, but I want to add a bit of context. The bug is that if you have 2 tabs open using the same DB, and the second tab has upgraded the db, the first tab is not getting the event.

If, however, you use one tab, load the page, edit the code to change the version, and reload the page, the event is fired properly.

So this is more an issue of someone using the same DB concurrently. Probably a bit more rare, but should still be fixed.
Comment 2 Radar WebKit Bug Importer 2015-04-25 14:51:47 PDT
<rdar://problem/20699757>
Comment 3 Brady Eidson 2016-03-21 21:33:34 PDT
This works great in Modern IDB: Confirmed in the latest WebKit Nightly (r198511)
Comment 4 Nolan Lawson 2016-03-30 10:40:16 PDT
I'm still able to reproduce the bug in WebKit Nightly r198834 - is that because I'm on Yosemite?

In the second tab, I don't see "Upgrading from version 1 / Connected to DB - you win!" Instead I just see "Database closed - go back to the other tab.", indicating the versionchange event wasn't fired.

I reproduced the correct behavior in both Chrome 49 and Firefox 47 for comparison. I also tested several times with different origins between each test.
Comment 5 Brady Eidson 2016-03-30 10:59:30 PDT
(In reply to comment #4)
> I'm still able to reproduce the bug in WebKit Nightly r198834 - is that
> because I'm on Yosemite?

Nope - In fact Yosemite definitely wouldn't have the nightly issues that El Cap has been having.

> In the second tab, I don't see "Upgrading from version 1 / Connected to DB -
> you win!" Instead I just see "Database closed - go back to the other tab.",
> indicating the versionchange event wasn't fired.
> 
> I reproduced the correct behavior in both Chrome 49 and Firefox 47 for
> comparison. I also tested several times with different origins between each
> test.

Can you "remove all website data" then try again?

Or, more directly, with Safari/Nightly *not* running, do:
`rm -rf ~/Library/Safari/Databases/___IndexedDB/`
...then try again.

I can reproduce the correct behavior in a nightly at-will.
Comment 6 Nolan Lawson 2016-03-30 11:05:31 PDT
I actually downloaded Jake's examples and ran them on localhost on multiple ports, so there ought to be no need to clear data. I tried five times and still couldn't reproduce the correct behavior.

I'm downloading El Cap and will try again...
Comment 7 Brady Eidson 2016-03-30 11:16:52 PDT
(In reply to comment #6)
> I actually downloaded Jake's examples and ran them on localhost on multiple
> ports, so there ought to be no need to clear data. I tried five times and
> still couldn't reproduce the correct behavior.
> 
> I'm downloading El Cap and will try again...

There's no expected reason why this would be a Yosemite vs El Cap difference.

One other (stretch) thought - You're not trying in private browsing mode, are you?
Comment 8 Nolan Lawson 2016-03-30 11:37:11 PDT
Nope, I wasn't in private browsing.

After upgrading to El Cap, I can confirm working in both WebKit Nightly r198834 and Safari Technology Preview 9.1.1 (11601.6.10, 11602.1.25). Not sure why it wasn't working in Yosemite (or if that was even my issue), but nice work! :)