hugoloza / gwt-mobile-webkit

Automatically exported from code.google.com/p/gwt-mobile-webkit
2 stars 0 forks source link

database disappears on history actions #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have a GWT application that uses gwt-mobile-webkit to access the sqllite 
web database supported by chrome. It works extremely well, except for one 
issue.

If the user clicks on the browser back button, then the database
totally vanishes and my application freezes as accesses to the
database cannot complete.

What do I need to do to make sure that any interaction with history
(within my webapp) does not break access to the database?

Thanks,

   -- Pierre

Original issue reported on code.google.com by pier...@google.com on 12 May 2010 at 5:57

GoogleCodeExporter commented 9 years ago
Some more information that I also sent to the chrome group...

The issue I am seeing is caused by triggering a history event that is external 
to my 
GWT app.

[For a good description of GWT history management, see 
http://developerlife.com/tutorials/?p=232]

From that article:
One more thing to note is that if you just type in a new token in the URL and 
tell 
your browser to load it, then it will load a new instance of your application. 
This 
is different than pressing a hyperlink, which re-uses the same instance of your 
app 
in the browser. In the example below, try this and note when the app loading 
screen 
shows up, vs when it doesn’t, and it will give you more clues to the nuances 
of how 
all of this works in browsers.

Now, when I click on the back button, I appear to still be executing on the 
same 
instance of my app (app is not reinitialzed), However, calling db.transaction() 
cannot proceed because the database is "gone" (i.e. in the developer's console, 
I 
cannot see the database tables anymore). 

I tried to re-open the database prior to making a call to the database after 
the back 
button is hit, but the problem persists.

So, let's say my app does not see the database anymore for whatever reason, 
shouldn't 
re-opening the database bring everything back to normal?

Original comment by pier...@google.com on 12 May 2010 at 3:28

GoogleCodeExporter commented 9 years ago
Hi Pierre,

You found quite an interesting issue with the Database API! Unfortunately I 
have no 
clue whatsoever what exactly is going on.

Q: Does this happen with Database access from plain Javascript as well?

BTW: in the past I found out that creating multiple instances of the same 
Database 
(Database.openDatabase()) actually created multiple databases (in Safari). 
Might be a 
related problem.

Original comment by bguijt on 12 May 2010 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by bguijt on 21 Aug 2010 at 9:04