Re: InedxedDB events : misconception?

2013-04-22 Thread Michaël Rouges
Oh, sorry... and thank you all for your explanations. :)

Re: InedxedDB events : misconception?

2013-04-22 Thread Michaël Rouges
Ok, the example of console.log () has made ​​me realize something I had never seen that. In short, if I understood from my tests, asynchronous instruction is executed at the earliest, after the last statement of the scope in which it is declared. There was a misconception ... in my mind. Please

Re: InedxedDB events : misconception?

2013-04-22 Thread Elliott Sprehn
On Mon, Apr 22, 2013 at 12:32 PM, Alec Flett wrote: > On Mon, Apr 22, 2013 at 9:56 AM, Michaël Rouges > wrote: > >> >> Hum ... thank you for this answer, but ... >> >> Are you sure there is no possibility that the application is completed >> before adding events? >> >> I find it hard to perceive

Re: InedxedDB events : misconception?

2013-04-22 Thread Joshua Bell
On Mon, Apr 22, 2013 at 1:57 PM, Kyle Huey wrote: > On Mon, Apr 22, 2013 at 1:50 PM, Joshua Bell wrote: > >> FWIW, we had a Chrome IDB bug report where someone used the developer >> tools to set a script breakpoint between the open() call and the event >> handler assignments. The debugger spins

Re: InedxedDB events : misconception?

2013-04-22 Thread Kyle Huey
On Mon, Apr 22, 2013 at 1:50 PM, Joshua Bell wrote: > FWIW, we had a Chrome IDB bug report where someone used the developer > tools to set a script breakpoint between the open() call and the event > handler assignments. The debugger spins the event loop, so the event was > dispatched before the h

Re: InedxedDB events : misconception?

2013-04-22 Thread Joshua Bell
Resending from the correct account: FWIW, we had a Chrome IDB bug report where someone used the developer tools to set a script breakpoint between the open() call and the event handler assignments. The debugger spins the event loop, so the event was dispatched before the handlers were assig

Re: InedxedDB events : misconception?

2013-04-22 Thread Boris Zbarsky
On 4/22/13 4:36 PM, Joshua Bell wrote: The debugger spins the event loop Fwiw, that seems like a bug in the debugger (albeit a common one in browser debuggers) :( -Boris

Re: InedxedDB events : misconception?

2013-04-22 Thread Alec Flett
On Mon, Apr 22, 2013 at 9:56 AM, Michaël Rouges wrote: > > Hum ... thank you for this answer, but ... > > Are you sure there is no possibility that the application is completed > before adding events? > > I find it hard to perceive how it couldn't happen. > Just to close the loop on this concern:

Re: InedxedDB events : misconception?

2013-04-22 Thread Jonas Sicking
On Mon, Apr 22, 2013 at 9:56 AM, Michaël Rouges wrote: > > Hum ... thank you for this answer, but ... > > Are you sure there is no possibility that the application is completed > before adding events? > > I find it hard to perceive how it couldn't happen. Do you also worry that if you wrote: x =

Re: InedxedDB events : misconception?

2013-04-22 Thread Boris Zbarsky
On 4/22/13 1:41 PM, Tab Atkins Jr. wrote: On Mon, Apr 22, 2013 at 10:36 AM, Boris Zbarsky wrote: On 4/22/13 1:31 PM, Tab Atkins Jr. wrote: Is there a reason to not pass the success/error/upgradeneeded callbacks in a dictionary to open() in this case, so that the request object is born with the

Re: InedxedDB events : misconception?

2013-04-22 Thread Tab Atkins Jr.
On Mon, Apr 22, 2013 at 10:36 AM, Boris Zbarsky wrote: > On 4/22/13 1:31 PM, Tab Atkins Jr. wrote: >>> Is there a reason to not pass the success/error/upgradeneeded callbacks >>> in a >>> dictionary to open() in this case, so that the request object is born >>> with >>> the right bits and the actu

Re: InedxedDB events : misconception?

2013-04-22 Thread Boris Zbarsky
On 4/22/13 1:31 PM, Tab Atkins Jr. wrote: Is there a reason to not pass the success/error/upgradeneeded callbacks in a dictionary to open() in this case, so that the request object is born with the right bits and the actual reques it not kicked off until _after_ the side-effects of getting them o

Re: InedxedDB events : misconception?

2013-04-22 Thread Tab Atkins Jr.
On Mon, Apr 22, 2013 at 10:17 AM, Boris Zbarsky wrote: > On 4/22/13 12:47 PM, Tab Atkins Jr. wrote: >> As long as you don't spin the event loop > > That's tricky. Here's some simple code at global scope: > > > request = indexedDB.open('database'); > request.onsuccess = function () {}; > > Can tha

Re: InedxedDB events : misconception?

2013-04-22 Thread Michaël Rouges
Sorry, I usually speak french and my english is quite experimental. The example I gave, with SetTimeout() is useless, if not illustrate that the interpreter does not expect that the events are attached to execute the query. My surprise comes from the comparison with the XMLHttpRequest object, whi

Re: InedxedDB events : misconception?

2013-04-22 Thread Boris Zbarsky
On 4/22/13 12:47 PM, Tab Atkins Jr. wrote: As long as you don't spin the event loop That's tricky. Here's some simple code at global scope: request = indexedDB.open('database'); request.onsuccess = function () {}; Can that code spin the event loop between the open() call and the onsuccess s

Re: InedxedDB events : misconception?

2013-04-22 Thread Tab Atkins Jr.
On Mon, Apr 22, 2013 at 9:56 AM, Michaël Rouges wrote: > Hum ... thank you for this answer, but ... > > Are you sure there is no possibility that the application is completed > before adding events? > > I find it hard to perceive how it couldn't happen. I don't quite understand what you're asking

Re: InedxedDB events : misconception?

2013-04-22 Thread Michaël Rouges
Hum ... thank you for this answer, but ... Are you sure there is no possibility that the application is completed before adding events? I find it hard to perceive how it couldn't happen.

Re: InedxedDB events : misconception?

2013-04-22 Thread Tab Atkins Jr.
On Mon, Apr 22, 2013 at 9:43 AM, Michaël Rouges wrote: > Hello everyone, > > I'm surprised by how events are added to IndexedDB objects. > > For example, base, opening a database: > > var request; > request = indexedDB.open('database'); > request.onsuccess = function () {}; > request.onupgradeneed

InedxedDB events : misconception?

2013-04-22 Thread Michaël Rouges
Hello everyone, I'm surprised by how events are added to IndexedDB objects. For example, base, opening a database: var request; request = indexedDB.open('database'); request.onsuccess = function () {}; request.onupgradeneeded = function () {}; request.onerror = function () {}; As you can see, t