Changeset 53840 in webkit


Ignore:
Timestamp:
Jan 25, 2010 10:23:35 PM (14 years ago)
Author:
jorlow@chromium.org
Message:

2010-01-22 Jeremy Orlow <jorlow@chromium.org>

Reviewed by Darin Adler.

Make storage events match the spec.
https://bugs.webkit.org/show_bug.cgi?id=30546

Update the storageEvent algorithm to match the change in WebCore.

  • src/StorageAreaProxy.cpp: (WebCore::StorageAreaProxy::storageEvent):

2010-01-22 Jeremy Orlow <jorlow@chromium.org>

Reviewed by Darin Adler.

Make storage events match the spec.
https://bugs.webkit.org/show_bug.cgi?id=30546

This meat of the patch I just posted is very simple. It's just making events
asynchronous, not posting them to the frame that generated them, passing a null
for the key when issuing a clear storage event, and making the events
non-cancelable/non-bubbleable...all of which are clearly stated in the spec.

The asynchronous and not posting to the frame that generated them forced me to
re-write all the layout tests that dealt with storage events. There's a lot of
code there, but I tried to be fairly careful to ensure that test coverage did
not shrink in any area.

Tests: storage/domstorage/events/basic-body-attribute.html

storage/domstorage/events/basic-setattribute.html
storage/domstorage/events/basic.html
storage/domstorage/events/case-sensitive.html
storage/domstorage/events/documentURI.html

  • dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::enqueueStorageEvent): (WebCore::Document::storageEventTimerFired):
  • dom/Document.h:
  • storage/StorageEvent.cpp: (WebCore::StorageEvent::StorageEvent):
  • storage/StorageEvent.idl:
  • storage/StorageEventDispatcher.cpp: (WebCore::StorageEventDispatcher::dispatch):

2010-01-22 Jeremy Orlow <jorlow@chromium.org>

Reviewed by Darin Adler.

Make storage events match the spec.
https://bugs.webkit.org/show_bug.cgi?id=30546

This meat of the patch I just posted is very simple. It's just making events
asynchronous, not posting them to the frame that generated them, passing a null
for the key when issuing a clear storage event, and making the events
non-cancelable/non-bubbleable...all of which are clearly stated in the spec.

The asynchronous and not posting to the frame that generated them forced me to
re-write all the layout tests that dealt with storage events. There's a lot of
code there, but I tried to be fairly careful to ensure that test coverage did
not shrink in any area.

  • storage/domstorage/complex-values-expected.txt:
  • storage/domstorage/documentURI-expected.txt: Removed.
  • storage/domstorage/documentURI.html: Removed.
  • storage/domstorage/events: Added.
  • storage/domstorage/events/basic-body-attribute-expected.txt: Added.
  • storage/domstorage/events/basic-body-attribute.html: Added.
  • storage/domstorage/events/basic-expected.txt: Added.
  • storage/domstorage/events/basic-setattribute-expected.txt: Added.
  • storage/domstorage/events/basic-setattribute.html: Added.
  • storage/domstorage/events/basic.html: Added.
  • storage/domstorage/events/case-sensitive-expected.txt: Added.
  • storage/domstorage/events/case-sensitive.html: Added.
  • storage/domstorage/events/documentURI-expected.txt: Added.
  • storage/domstorage/events/documentURI.html: Added.
  • storage/domstorage/events/resources: Added.
  • storage/domstorage/events/resources/body-event-handler.html: Added.
  • storage/domstorage/events/resources/eventTestHarness.js: Added.
  • storage/domstorage/events/resources/setattribute-event-handler.html: Added.
  • storage/domstorage/events/script-tests: Added.
  • storage/domstorage/events/script-tests/TEMPLATE.html: Copied from LayoutTests/storage/domstorage/script-tests/TEMPLATE.html.
  • storage/domstorage/events/script-tests/basic-body-attribute.js: Added.
  • storage/domstorage/events/script-tests/basic-setattribute.js: Added.
  • storage/domstorage/events/script-tests/basic.js: Added.
  • storage/domstorage/events/script-tests/case-sensitive.js: Added.
  • storage/domstorage/events/script-tests/documentURI.js: Added.
  • storage/domstorage/localstorage/iframe-events-expected.txt: Removed.
  • storage/domstorage/localstorage/iframe-events.html: Removed.
  • storage/domstorage/localstorage/index-get-and-set-expected.txt:
  • storage/domstorage/localstorage/index-get-and-set.html:
  • storage/domstorage/localstorage/onstorage-attribute-markup-expected.txt: Removed.
  • storage/domstorage/localstorage/onstorage-attribute-markup.html: Removed.
  • storage/domstorage/localstorage/onstorage-attribute-setattribute-expected.txt: Removed.
  • storage/domstorage/localstorage/onstorage-attribute-setattribute.html: Removed.
  • storage/domstorage/localstorage/onstorage-attribute-setwindow-expected.txt: Removed.
  • storage/domstorage/localstorage/onstorage-attribute-setwindow.html: Removed.
  • storage/domstorage/localstorage/simple-events-expected.txt: Removed.
  • storage/domstorage/localstorage/simple-events.html: Removed.
  • storage/domstorage/script-tests/complex-values.js:
  • storage/domstorage/script-tests/documentURI.js: Removed.
  • storage/domstorage/sessionstorage/iframe-events-expected.txt: Removed.
  • storage/domstorage/sessionstorage/iframe-events.html: Removed.
  • storage/domstorage/sessionstorage/index-get-and-set-expected.txt:
  • storage/domstorage/sessionstorage/index-get-and-set.html:
  • storage/domstorage/sessionstorage/onstorage-attribute-markup-expected.txt: Removed.
  • storage/domstorage/sessionstorage/onstorage-attribute-markup.html: Removed.
  • storage/domstorage/sessionstorage/onstorage-attribute-setattribute-expected.txt: Removed.
  • storage/domstorage/sessionstorage/onstorage-attribute-setattribute.html: Removed.
  • storage/domstorage/sessionstorage/onstorage-attribute-setwindow-expected.txt: Removed.
  • storage/domstorage/sessionstorage/onstorage-attribute-setwindow.html: Removed.
  • storage/domstorage/sessionstorage/simple-events-expected.txt: Removed.
  • storage/domstorage/sessionstorage/simple-events.html: Removed.
  • storage/domstorage/window-attributes-exist-expected.txt:
  • storage/domstorage/window-attributes-exist.html:
Location:
trunk
Files:
21 added
23 deleted
17 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53839 r53840  
     12010-01-22  Jeremy Orlow  <jorlow@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Make storage events match the spec.
     6        https://bugs.webkit.org/show_bug.cgi?id=30546
     7
     8        This meat of the patch I just posted is very simple.  It's just making events
     9        asynchronous, not posting them to the frame that generated them, passing a null
     10        for the key when issuing a clear storage event, and making the events
     11        non-cancelable/non-bubbleable...all of which are clearly stated in the spec.
     12
     13        The asynchronous and not posting to the frame that generated them forced me to
     14        re-write all the layout tests that dealt with storage events.  There's a lot of
     15        code there, but I tried to be fairly careful to ensure that test coverage did
     16        not shrink in any area.
     17
     18        * storage/domstorage/complex-values-expected.txt:
     19        * storage/domstorage/documentURI-expected.txt: Removed.
     20        * storage/domstorage/documentURI.html: Removed.
     21        * storage/domstorage/events: Added.
     22        * storage/domstorage/events/basic-body-attribute-expected.txt: Added.
     23        * storage/domstorage/events/basic-body-attribute.html: Added.
     24        * storage/domstorage/events/basic-expected.txt: Added.
     25        * storage/domstorage/events/basic-setattribute-expected.txt: Added.
     26        * storage/domstorage/events/basic-setattribute.html: Added.
     27        * storage/domstorage/events/basic.html: Added.
     28        * storage/domstorage/events/case-sensitive-expected.txt: Added.
     29        * storage/domstorage/events/case-sensitive.html: Added.
     30        * storage/domstorage/events/documentURI-expected.txt: Added.
     31        * storage/domstorage/events/documentURI.html: Added.
     32        * storage/domstorage/events/resources: Added.
     33        * storage/domstorage/events/resources/body-event-handler.html: Added.
     34        * storage/domstorage/events/resources/eventTestHarness.js: Added.
     35        * storage/domstorage/events/resources/setattribute-event-handler.html: Added.
     36        * storage/domstorage/events/script-tests: Added.
     37        * storage/domstorage/events/script-tests/TEMPLATE.html: Copied from LayoutTests/storage/domstorage/script-tests/TEMPLATE.html.
     38        * storage/domstorage/events/script-tests/basic-body-attribute.js: Added.
     39        * storage/domstorage/events/script-tests/basic-setattribute.js: Added.
     40        * storage/domstorage/events/script-tests/basic.js: Added.
     41        * storage/domstorage/events/script-tests/case-sensitive.js: Added.
     42        * storage/domstorage/events/script-tests/documentURI.js: Added.
     43        * storage/domstorage/localstorage/iframe-events-expected.txt: Removed.
     44        * storage/domstorage/localstorage/iframe-events.html: Removed.
     45        * storage/domstorage/localstorage/index-get-and-set-expected.txt:
     46        * storage/domstorage/localstorage/index-get-and-set.html:
     47        * storage/domstorage/localstorage/onstorage-attribute-markup-expected.txt: Removed.
     48        * storage/domstorage/localstorage/onstorage-attribute-markup.html: Removed.
     49        * storage/domstorage/localstorage/onstorage-attribute-setattribute-expected.txt: Removed.
     50        * storage/domstorage/localstorage/onstorage-attribute-setattribute.html: Removed.
     51        * storage/domstorage/localstorage/onstorage-attribute-setwindow-expected.txt: Removed.
     52        * storage/domstorage/localstorage/onstorage-attribute-setwindow.html: Removed.
     53        * storage/domstorage/localstorage/simple-events-expected.txt: Removed.
     54        * storage/domstorage/localstorage/simple-events.html: Removed.
     55        * storage/domstorage/script-tests/complex-values.js:
     56        * storage/domstorage/script-tests/documentURI.js: Removed.
     57        * storage/domstorage/sessionstorage/iframe-events-expected.txt: Removed.
     58        * storage/domstorage/sessionstorage/iframe-events.html: Removed.
     59        * storage/domstorage/sessionstorage/index-get-and-set-expected.txt:
     60        * storage/domstorage/sessionstorage/index-get-and-set.html:
     61        * storage/domstorage/sessionstorage/onstorage-attribute-markup-expected.txt: Removed.
     62        * storage/domstorage/sessionstorage/onstorage-attribute-markup.html: Removed.
     63        * storage/domstorage/sessionstorage/onstorage-attribute-setattribute-expected.txt: Removed.
     64        * storage/domstorage/sessionstorage/onstorage-attribute-setattribute.html: Removed.
     65        * storage/domstorage/sessionstorage/onstorage-attribute-setwindow-expected.txt: Removed.
     66        * storage/domstorage/sessionstorage/onstorage-attribute-setwindow.html: Removed.
     67        * storage/domstorage/sessionstorage/simple-events-expected.txt: Removed.
     68        * storage/domstorage/sessionstorage/simple-events.html: Removed.
     69        * storage/domstorage/window-attributes-exist-expected.txt:
     70        * storage/domstorage/window-attributes-exist.html:
     71
    1722010-01-25  Dan Bernstein  <mitz@apple.com>
    273
  • trunk/LayoutTests/storage/domstorage/complex-values-expected.txt

    r50176 r53840  
    103103PASS storage.getItem('foo12') is "ÿ찡hello"
    104104
    105 Verify storage events are case sensitive
    106 storage.foo = 'test'
    107 Setting event listener
    108 PASS eventCounter is 0
    109 storage.foo = 'test'
    110 PASS eventCounter is 0
    111 storage.foo = 'TEST'
    112 PASS eventCounter is 1
    113 
    114105
    115106Testing localStorage
     
    211202PASS typeof storage.getItem('foo12') is "string"
    212203PASS storage.getItem('foo12') is "ÿ찡hello"
    213 
    214 Verify storage events are case sensitive
    215 storage.foo = 'test'
    216 Setting event listener
    217 PASS eventCounter is 0
    218 storage.foo = 'test'
    219 PASS eventCounter is 0
    220 storage.foo = 'TEST'
    221 PASS eventCounter is 1
    222204PASS successfullyParsed is true
    223205
  • trunk/LayoutTests/storage/domstorage/events/script-tests/TEMPLATE.html

    r53232 r53840  
    11<html>
    22<head>
    3 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
    4 <script src="../../fast/js/resources/js-test-pre.js"></script>
    5 <script src="../../fast/js/resources/js-test-post-function.js"></script>
     3<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
     4<script src="../../../fast/js/resources/js-test-pre.js"></script>
     5<script src="../../../fast/js/resources/js-test-post-function.js"></script>
    66</head>
    77<body>
    88<p id="description"></p>
    99<div id="console"></div>
     10<script src="resources/eventTestHarness.js"></script>
    1011<script src="YOUR_JS_FILE_HERE"></script>
    1112</body>
  • trunk/LayoutTests/storage/domstorage/localstorage/index-get-and-set-expected.txt

    r31908 r53840  
    11This is a test to make sure you can get and set values in localStorage by index.
    22Setting FOO using the index setter.
    3 Storage event fired:
    4 Key - FOO
    5 New Value - BAR
    6 Old Value - null
    7 
    83Reading FOO:
    94BAR
     
    127
    138Setting FOO again, using setItem.
    14 Storage event fired:
    15 Key - FOO
    16 New Value - BAZ
    17 Old Value - BAR
    18 
    199Reading FOO:
    2010BAZ
     
    2313
    2414Setting FOO again, using the index setter.
    25 Storage event fired:
    26 Key - FOO
    27 New Value - BAT
    28 Old Value - BAZ
    29 
    3015Reading FOO:
    3116BAT
     
    3419
    3520Setting FOO again, using property-slot syntax
    36 Storage event fired:
    37 Key - FOO
    38 New Value - BATMAN
    39 Old Value - BAT
    40 
    4121Reading FOO:
    4222BATMAN
     
    4525
    4626Removing FOO, then trying to read it
    47 Storage event fired:
    48 Key - FOO
    49 New Value - null
    50 Old Value - BATMAN
    51 
    5227Reading FOO:
    5328undefined
  • trunk/LayoutTests/storage/domstorage/localstorage/index-get-and-set.html

    r46314 r53840  
    2020}
    2121
    22 function handleStorageEvent(e)
    23 {
    24     log("Storage event fired:");
    25     log("Key           - " + e.key);
    26     log("New Value     - " + e.newValue);
    27     log("Old Value     - " + e.oldValue);
    28     log("");
    29 }
    30 
    3122function runTest()
    3223{
     
    3627        return;
    3728    }
    38    
    39     window.addEventListener("storage", handleStorageEvent, false);
    4029   
    4130    log("Setting FOO using the index setter.");
  • trunk/LayoutTests/storage/domstorage/script-tests/complex-values.js

    r50176 r53840  
    11description("Test some corner case DOM Storage values.");
    2 
    3 eventCounter = 0;
    4 function handleStorageEvent() {
    5     eventCounter++;
    6 }
    72
    83function testKeyValue(key, value)
     
    7469    evalAndLog("storage.setItem('foo12', k)");
    7570    testKeyValue("foo12", k);
    76 
    77     debug("");
    78     debug("Verify storage events are case sensitive");
    79     evalAndLog("storage.foo = 'test'");
    80     debug("Setting event listener");
    81     window.addEventListener("storage", handleStorageEvent, false);
    82     shouldBe("eventCounter", "0");
    83     evalAndLog("storage.foo = 'test'");
    84     shouldBe("eventCounter", "0");
    85     evalAndLog("storage.foo = 'TEST'");
    86     shouldBe("eventCounter", "1");
    87 
    88     // Reset the counter for next tests (if any).
    89     window.removeEventListener("storage", handleStorageEvent, false);
    90     eventCounter = 0;
    9171}
    9272
  • trunk/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set-expected.txt

    r31697 r53840  
    11This is a test to make sure you can get and set values in SessionStorage by index.
    22Setting FOO using the index setter.
    3 Storage event fired:
    4 Key - FOO
    5 New Value - BAR
    6 Old Value - null
    7 
    83Reading FOO:
    94BAR
     
    127
    138Setting FOO again, using setItem.
    14 Storage event fired:
    15 Key - FOO
    16 New Value - BAZ
    17 Old Value - BAR
    18 
    199Reading FOO:
    2010BAZ
     
    2313
    2414Setting FOO again, using the index setter.
    25 Storage event fired:
    26 Key - FOO
    27 New Value - BAT
    28 Old Value - BAZ
    29 
    3015Reading FOO:
    3116BAT
     
    3419
    3520Setting FOO again, using property-slot syntax
    36 Storage event fired:
    37 Key - FOO
    38 New Value - BATMAN
    39 Old Value - BAT
    40 
    4121Reading FOO:
    4222BATMAN
     
    4525
    4626Removing FOO, then trying to read it
    47 Storage event fired:
    48 Key - FOO
    49 New Value - null
    50 Old Value - BATMAN
    51 
    5227Reading FOO:
    5328undefined
  • trunk/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set.html

    r46314 r53840  
    2020}
    2121
    22 function handleStorageEvent(e)
    23 {
    24     log("Storage event fired:");
    25     log("Key           - " + e.key);
    26     log("New Value     - " + e.newValue);
    27     log("Old Value     - " + e.oldValue);
    28     log("");
    29 }
    30 
    3122function runTest()
    3223{
     
    3627        return;
    3728    }
    38    
    39     window.addEventListener("storage", handleStorageEvent, false);
    4029   
    4130    log("Setting FOO using the index setter.");
  • trunk/LayoutTests/storage/domstorage/window-attributes-exist-expected.txt

    r46498 r53840  
    1919window.localStorage === window.localStorage: true
    2020window.onstorage exists
    21 The onstorage property works when a storage event is fired.
    2221
  • trunk/LayoutTests/storage/domstorage/window-attributes-exist.html

    r46498 r53840  
    2727}
    2828
    29 function testOnstorage()
    30 {
    31     window.onstorage = function(event)
    32     {
    33         log("The onstorage property works when a storage event is fired.");
    34     }
    35    
    36     window.localStorage["test"] = "test";
    37 }
    38 
    3929function runTest()
    4030{
     
    5545        log("window.localStorage DOES NOT exist");
    5646
    57     if ("onstorage" in window) {
     47    if ("onstorage" in window)
    5848        log("window.onstorage exists");
    59         testOnstorage();
    60     } else
     49    else
    6150        log("window.onstorage DOES NOT exist");
    6251}
  • trunk/WebCore/ChangeLog

    r53839 r53840  
     12010-01-22  Jeremy Orlow  <jorlow@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Make storage events match the spec.
     6        https://bugs.webkit.org/show_bug.cgi?id=30546
     7
     8        This meat of the patch I just posted is very simple.  It's just making events
     9        asynchronous, not posting them to the frame that generated them, passing a null
     10        for the key when issuing a clear storage event, and making the events
     11        non-cancelable/non-bubbleable...all of which are clearly stated in the spec.
     12
     13        The asynchronous and not posting to the frame that generated them forced me to
     14        re-write all the layout tests that dealt with storage events.  There's a lot of
     15        code there, but I tried to be fairly careful to ensure that test coverage did
     16        not shrink in any area.
     17
     18        Tests: storage/domstorage/events/basic-body-attribute.html
     19               storage/domstorage/events/basic-setattribute.html
     20               storage/domstorage/events/basic.html
     21               storage/domstorage/events/case-sensitive.html
     22               storage/domstorage/events/documentURI.html
     23
     24        * dom/Document.cpp:
     25        (WebCore::Document::Document):
     26        (WebCore::Document::enqueueStorageEvent):
     27        (WebCore::Document::storageEventTimerFired):
     28        * dom/Document.h:
     29        * storage/StorageEvent.cpp:
     30        (WebCore::StorageEvent::StorageEvent):
     31        * storage/StorageEvent.idl:
     32        * storage/StorageEventDispatcher.cpp:
     33        (WebCore::StorageEventDispatcher::dispatch):
     34
    1352010-01-25  Dan Bernstein  <mitz@apple.com>
    236
  • trunk/WebCore/dom/Document.cpp

    r53809 r53840  
    389389#endif
    390390    , m_usingGeolocation(false)
     391    , m_storageEventTimer(this, &Document::storageEventTimerFired)
    391392#if ENABLE(WML)
    392393    , m_containsWMLContent(false)
     
    29922993        return;
    29932994    domWindow->dispatchLoadEvent();
     2995}
     2996
     2997void Document::enqueueStorageEvent(PassRefPtr<Event> storageEvent)
     2998{
     2999    m_storageEventQueue.append(storageEvent);
     3000    if (!m_storageEventTimer.isActive())
     3001        m_storageEventTimer.startOneShot(0);
     3002}
     3003
     3004void Document::storageEventTimerFired(Timer<Document>*)
     3005{
     3006    ASSERT(!m_storageEventTimer.isActive());
     3007    Vector<RefPtr<Event> > storageEventQueue;
     3008    storageEventQueue.swap(m_storageEventQueue);
     3009
     3010    typedef Vector<RefPtr<Event> >::const_iterator Iterator;
     3011    Iterator end = storageEventQueue.end();
     3012    for (Iterator it = storageEventQueue.begin(); it != end; ++it)
     3013        dispatchWindowEvent(*it);
    29943014}
    29953015
  • trunk/WebCore/dom/Document.h

    r53809 r53840  
    619619    void dispatchWindowLoadEvent();
    620620
     621    void enqueueStorageEvent(PassRefPtr<Event>);
     622    void storageEventTimerFired(Timer<Document>*);
     623
    621624    PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&);
    622625
     
    11841187    bool m_usingGeolocation;
    11851188
     1189    Timer<Document> m_storageEventTimer;
     1190    Vector<RefPtr<Event> > m_storageEventQueue;
     1191
    11861192#if ENABLE(WML)
    11871193    bool m_containsWMLContent;
  • trunk/WebCore/storage/StorageEvent.cpp

    r49830 r53840  
    4848
    4949StorageEvent::StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& uri, Storage* storageArea)
    50     : Event(type, false, true)
     50    : Event(type, false, false)
    5151    , m_key(key)
    5252    , m_oldValue(oldValue)
  • trunk/WebCore/storage/StorageEvent.idl

    r52537 r53840  
    2929        Conditional=DOM_STORAGE
    3030    ] StorageEvent : Event {
    31         readonly attribute DOMString key;
     31        readonly attribute [ConvertNullStringTo=Null] DOMString key;
    3232        readonly attribute [ConvertNullStringTo=Null] DOMString oldValue;
    3333        readonly attribute [ConvertNullStringTo=Null] DOMString newValue;
  • trunk/WebCore/storage/StorageEventDispatcher.cpp

    r50088 r53840  
    5151        // Send events only to our page.
    5252        for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    53             if (frame->document()->securityOrigin()->equal(securityOrigin))
     53            if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
    5454                frames.append(frame);
    5555        }
    5656
    5757        for (unsigned i = 0; i < frames.size(); ++i)
    58             frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage()));
     58            frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage()));
    5959    } else {
    6060        // Send events to every page.
     
    6363        for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
    6464            for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    65                 if (frame->document()->securityOrigin()->equal(securityOrigin))
     65                if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
    6666                    frames.append(frame);
    6767            }
     
    6969
    7070        for (unsigned i = 0; i < frames.size(); ++i)
    71             frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->localStorage()));
     71            frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->localStorage()));
    7272    }
    7373}
  • trunk/WebKit/chromium/ChangeLog

    r53759 r53840  
     12010-01-22  Jeremy Orlow  <jorlow@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Make storage events match the spec.
     6        https://bugs.webkit.org/show_bug.cgi?id=30546
     7
     8        Update the storageEvent algorithm to match the change in WebCore.
     9
     10        * src/StorageAreaProxy.cpp:
     11        (WebCore::StorageAreaProxy::storageEvent):
     12
    1132010-01-22  Elliot Glaysher  <erg@chromium.org>
    214
  • trunk/WebKit/chromium/src/StorageAreaProxy.cpp

    r53710 r53840  
    120120        // Send events only to our page.
    121121        for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    122             if (frame->document()->securityOrigin()->equal(securityOrigin))
     122            if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
    123123                frames.append(frame);
    124124        }
    125125
    126126        for (unsigned i = 0; i < frames.size(); ++i)
    127             frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage()));
     127            frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->sessionStorage()));
    128128    } else {
    129129        // Send events to every page.
     
    132132        for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
    133133            for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
    134                 if (frame->document()->securityOrigin()->equal(securityOrigin))
     134                if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
    135135                    frames.append(frame);
    136136            }
     
    138138
    139139        for (unsigned i = 0; i < frames.size(); ++i)
    140             frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->localStorage()));
     140            frames[i]->document()->enqueueStorageEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), frames[i]->domWindow()->localStorage()));
    141141    }
    142142}
Note: See TracChangeset for help on using the changeset viewer.