Storage event not fire in page which triggered storage change!

716 views
Skip to first unread message

imiaou

unread,
Sep 8, 2010, 10:19:10 PM9/8/10
to Chromium HTML5
I write a test here: https://dl.dropbox.com/u/293671/localStorage-Event.html
Open this url in more than 2 tabs or windows, clicking the button will
log the newValue into console. All the tabs will log it, except the
tab which triggered change.
Is this what the spec means or implementation bug?

I tested it in Chrome 6 dev and Safari 5.01. Both have the same
result, so I think it's what the spec means. But why?

BTW: How can I determine when localStorage finishes storing data?

PhistucK

unread,
Sep 9, 2010, 3:12:15 AM9/9/10
to imiaou, Chromium HTML5
Comments inline.

PhistucK



On Thu, Sep 9, 2010 at 05:19, imiaou <imi...@gmail.com> wrote:
I write a test here: https://dl.dropbox.com/u/293671/localStorage-Event.html

It does not say "It works" for me, on any tab. 


Open this url in more than 2 tabs or windows, clicking the button will
log the newValue into console. All the tabs will log it, except the
tab which triggered change.
Is this what the spec means or implementation bug?

I tested it in Chrome 6 dev and Safari 5.01. Both have the same
result, so I think it's what the spec means. But why?

BTW: How can I determine when localStorage finishes storing data?


If you mean physically (on disk), I am not sure you can.
If not, I guess that storage event means it finished storing the data, but this is really just an guess.

--
You received this message because you are subscribed to the Google Groups "Chromium HTML5" group.
To post to this group, send email to chromiu...@chromium.org.
To unsubscribe from this group, send email to chromium-html...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-html5/?hl=en.


Jeremy Orlow

unread,
Sep 9, 2010, 5:41:20 AM9/9/10
to imiaou, Chromium HTML5
On Thu, Sep 9, 2010 at 3:19 AM, imiaou <imi...@gmail.com> wrote:
I write a test here: https://dl.dropbox.com/u/293671/localStorage-Event.html
Open this url in more than 2 tabs or windows, clicking the button will
log the newValue into console. All the tabs will log it, except the
tab which triggered change.
Is this what the spec means or implementation bug?

I tested it in Chrome 6 dev and Safari 5.01. Both have the same
result, so I think it's what the spec means. But why?

This is how it's specced.  But just because Chrome and Safari do something doesn't mean much--we both share a very large amount of code which means we share a lot of bugs too.  :-)

If you need to know about updates your script made to your own page, you should be able to do this fairly easily in your script, I believe.  What are you trying to do?

As for why it's this way, I don't really remember.  Look in the archives for whatwg?

BTW: How can I determine when localStorage finishes storing data?

You can't.  LocalStorage doesn't support transactions.  If you need this, look at WebSQLDatabase (or IndexedDB, soon).

On Thu, Sep 9, 2010 at 8:12 AM, PhistucK <phis...@gmail.com> wrote:
If you mean physically (on disk), I am not sure you can.
If not, I guess that storage event means it finished storing the data, but this is really just an guess.

It doesn't. 

J

imiaou

unread,
Sep 9, 2010, 8:22:06 AM9/9/10
to Chromium HTML5
>But just because Chrome and Safari do something
>doesn't mean much--we both share a very large amount of code which means we
>share a lot of bugs too. :-)

I just test it in FF3.6.8, the firing order is totally a mess. But it
fires 2 times if the URL is opened in 2 tabs.

>What are you trying to do?

I store large amount of datas into localStorage, such as base64
images. So I want to make sure the storage is success then move on to
next task.
I think I misunderstood the spec.

> If you need this, look at WebSQLDatabase (or IndexedDB, soon).

Thanks for your suggestion, Web SQL is quite unfamiliar for me and I'm
trying to make things simple. localStorage is good enough for me.

Thanks.
-imiaou

Jeremy Orlow

unread,
Sep 9, 2010, 8:31:32 AM9/9/10
to imiaou, Chromium HTML5
On Thu, Sep 9, 2010 at 1:22 PM, imiaou <imi...@gmail.com> wrote:
>But just because Chrome and Safari do something
>doesn't mean much--we both share a very large amount of code which means we
>share a lot of bugs too.  :-)

I just test it in FF3.6.8, the firing order is totally a mess. But it
fires 2 times if the URL is opened in 2 tabs.

You might want to file a bug on firefox then.
 
>What are you trying to do?

I store large amount of datas into localStorage, such as base64
images. So I want to make sure the storage is success then move on to
next task.
I think I misunderstood the spec.

LocalStorage is a synchronous API so we won't return control to you until it's stored in memory.  We then sync as fast as we can.
 
> If you need this, look at WebSQLDatabase (or IndexedDB, soon).

Thanks for your suggestion, Web SQL is quite unfamiliar for me and I'm
trying to make things simple. localStorage is good enough for me.

Thanks.
-imiaou
Reply all
Reply to author
Forward
0 new messages