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
<rdar://problem/27040485>
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.
<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.