Bug 159174 - Main frame storage event never dispatched for localStorage/sessionStorage modifications
Summary: Main frame storage event never dispatched for localStorage/sessionStorage mod...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-06-27 15:27 PDT by Joseph Pecoraro
Modified: 2016-06-27 17:00 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-06-27 15:27:36 PDT
Summary:
Main frame storage event never dispatched for localStorage/sessionStorage modifications

Steps to Reproduce:
1. Inspect this page
2. js> window.onstorage = function(e) { console.log(e); }; localStorage.x = 123;
  => Expected console to log, it did not.

Notes:
- LayoutTests/storage/domstorage/events/basic.html shows that the storage event does fire for a subframe, but surprisingly it does not fire for the main frame
Comment 1 Radar WebKit Bug Importer 2016-06-27 15:28:07 PDT
<rdar://problem/27040485>
Comment 2 Joseph Pecoraro 2016-06-27 16:51:32 PDT
MDN says, about the Storage Event:
This won't work on the same page that is making the changes — it is really a way for other pages on the domain using the storage to sync any changes that are made.

So if that is the case, this is behaving correctly.
Comment 3 Joseph Pecoraro 2016-06-27 17:00:22 PDT
<https://html.spec.whatwg.org/multipage/webstorage.html#the-localstorage-attribute>

> When the setItem(), removeItem(), and clear() methods are called on a Storage object x
> that is associated with a local storage area, if the methods did not throw an exception
> or "do nothing" as defined above, then for every Document object whose Window object's
> localStorage attribute's Storage object is associated with the same storage area,
> other than x, send a storage notification.

The operative words being "other than x".

Seems like this behaves correctly, closing.