Changeset 53840 in webkit
- Timestamp:
- Jan 25, 2010 10:23:35 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 21 added
- 23 deleted
- 17 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r53839 r53840 1 2010-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 1 72 2010-01-25 Dan Bernstein <mitz@apple.com> 2 73 -
trunk/LayoutTests/storage/domstorage/complex-values-expected.txt
r50176 r53840 103 103 PASS storage.getItem('foo12') is "ÿ찡hello" 104 104 105 Verify storage events are case sensitive106 storage.foo = 'test'107 Setting event listener108 PASS eventCounter is 0109 storage.foo = 'test'110 PASS eventCounter is 0111 storage.foo = 'TEST'112 PASS eventCounter is 1113 114 105 115 106 Testing localStorage … … 211 202 PASS typeof storage.getItem('foo12') is "string" 212 203 PASS storage.getItem('foo12') is "ÿ찡hello" 213 214 Verify storage events are case sensitive215 storage.foo = 'test'216 Setting event listener217 PASS eventCounter is 0218 storage.foo = 'test'219 PASS eventCounter is 0220 storage.foo = 'TEST'221 PASS eventCounter is 1222 204 PASS successfullyParsed is true 223 205 -
trunk/LayoutTests/storage/domstorage/events/script-tests/TEMPLATE.html
r53232 r53840 1 1 <html> 2 2 <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> 6 6 </head> 7 7 <body> 8 8 <p id="description"></p> 9 9 <div id="console"></div> 10 <script src="resources/eventTestHarness.js"></script> 10 11 <script src="YOUR_JS_FILE_HERE"></script> 11 12 </body> -
trunk/LayoutTests/storage/domstorage/localstorage/index-get-and-set-expected.txt
r31908 r53840 1 1 This is a test to make sure you can get and set values in localStorage by index. 2 2 Setting FOO using the index setter. 3 Storage event fired:4 Key - FOO5 New Value - BAR6 Old Value - null7 8 3 Reading FOO: 9 4 BAR … … 12 7 13 8 Setting FOO again, using setItem. 14 Storage event fired:15 Key - FOO16 New Value - BAZ17 Old Value - BAR18 19 9 Reading FOO: 20 10 BAZ … … 23 13 24 14 Setting FOO again, using the index setter. 25 Storage event fired:26 Key - FOO27 New Value - BAT28 Old Value - BAZ29 30 15 Reading FOO: 31 16 BAT … … 34 19 35 20 Setting FOO again, using property-slot syntax 36 Storage event fired:37 Key - FOO38 New Value - BATMAN39 Old Value - BAT40 41 21 Reading FOO: 42 22 BATMAN … … 45 25 46 26 Removing FOO, then trying to read it 47 Storage event fired:48 Key - FOO49 New Value - null50 Old Value - BATMAN51 52 27 Reading FOO: 53 28 undefined -
trunk/LayoutTests/storage/domstorage/localstorage/index-get-and-set.html
r46314 r53840 20 20 } 21 21 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 31 22 function runTest() 32 23 { … … 36 27 return; 37 28 } 38 39 window.addEventListener("storage", handleStorageEvent, false);40 29 41 30 log("Setting FOO using the index setter."); -
trunk/LayoutTests/storage/domstorage/script-tests/complex-values.js
r50176 r53840 1 1 description("Test some corner case DOM Storage values."); 2 3 eventCounter = 0;4 function handleStorageEvent() {5 eventCounter++;6 }7 2 8 3 function testKeyValue(key, value) … … 74 69 evalAndLog("storage.setItem('foo12', k)"); 75 70 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;91 71 } 92 72 -
trunk/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set-expected.txt
r31697 r53840 1 1 This is a test to make sure you can get and set values in SessionStorage by index. 2 2 Setting FOO using the index setter. 3 Storage event fired:4 Key - FOO5 New Value - BAR6 Old Value - null7 8 3 Reading FOO: 9 4 BAR … … 12 7 13 8 Setting FOO again, using setItem. 14 Storage event fired:15 Key - FOO16 New Value - BAZ17 Old Value - BAR18 19 9 Reading FOO: 20 10 BAZ … … 23 13 24 14 Setting FOO again, using the index setter. 25 Storage event fired:26 Key - FOO27 New Value - BAT28 Old Value - BAZ29 30 15 Reading FOO: 31 16 BAT … … 34 19 35 20 Setting FOO again, using property-slot syntax 36 Storage event fired:37 Key - FOO38 New Value - BATMAN39 Old Value - BAT40 41 21 Reading FOO: 42 22 BATMAN … … 45 25 46 26 Removing FOO, then trying to read it 47 Storage event fired:48 Key - FOO49 New Value - null50 Old Value - BATMAN51 52 27 Reading FOO: 53 28 undefined -
trunk/LayoutTests/storage/domstorage/sessionstorage/index-get-and-set.html
r46314 r53840 20 20 } 21 21 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 31 22 function runTest() 32 23 { … … 36 27 return; 37 28 } 38 39 window.addEventListener("storage", handleStorageEvent, false);40 29 41 30 log("Setting FOO using the index setter."); -
trunk/LayoutTests/storage/domstorage/window-attributes-exist-expected.txt
r46498 r53840 19 19 window.localStorage === window.localStorage: true 20 20 window.onstorage exists 21 The onstorage property works when a storage event is fired.22 21 -
trunk/LayoutTests/storage/domstorage/window-attributes-exist.html
r46498 r53840 27 27 } 28 28 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 39 29 function runTest() 40 30 { … … 55 45 log("window.localStorage DOES NOT exist"); 56 46 57 if ("onstorage" in window) {47 if ("onstorage" in window) 58 48 log("window.onstorage exists"); 59 testOnstorage(); 60 } else 49 else 61 50 log("window.onstorage DOES NOT exist"); 62 51 } -
trunk/WebCore/ChangeLog
r53839 r53840 1 2010-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 1 35 2010-01-25 Dan Bernstein <mitz@apple.com> 2 36 -
trunk/WebCore/dom/Document.cpp
r53809 r53840 389 389 #endif 390 390 , m_usingGeolocation(false) 391 , m_storageEventTimer(this, &Document::storageEventTimerFired) 391 392 #if ENABLE(WML) 392 393 , m_containsWMLContent(false) … … 2992 2993 return; 2993 2994 domWindow->dispatchLoadEvent(); 2995 } 2996 2997 void Document::enqueueStorageEvent(PassRefPtr<Event> storageEvent) 2998 { 2999 m_storageEventQueue.append(storageEvent); 3000 if (!m_storageEventTimer.isActive()) 3001 m_storageEventTimer.startOneShot(0); 3002 } 3003 3004 void 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); 2994 3014 } 2995 3015 -
trunk/WebCore/dom/Document.h
r53809 r53840 619 619 void dispatchWindowLoadEvent(); 620 620 621 void enqueueStorageEvent(PassRefPtr<Event>); 622 void storageEventTimerFired(Timer<Document>*); 623 621 624 PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&); 622 625 … … 1184 1187 bool m_usingGeolocation; 1185 1188 1189 Timer<Document> m_storageEventTimer; 1190 Vector<RefPtr<Event> > m_storageEventQueue; 1191 1186 1192 #if ENABLE(WML) 1187 1193 bool m_containsWMLContent; -
trunk/WebCore/storage/StorageEvent.cpp
r49830 r53840 48 48 49 49 StorageEvent::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) 51 51 , m_key(key) 52 52 , m_oldValue(oldValue) -
trunk/WebCore/storage/StorageEvent.idl
r52537 r53840 29 29 Conditional=DOM_STORAGE 30 30 ] StorageEvent : Event { 31 readonly attribute DOMString key;31 readonly attribute [ConvertNullStringTo=Null] DOMString key; 32 32 readonly attribute [ConvertNullStringTo=Null] DOMString oldValue; 33 33 readonly attribute [ConvertNullStringTo=Null] DOMString newValue; -
trunk/WebCore/storage/StorageEventDispatcher.cpp
r50088 r53840 51 51 // Send events only to our page. 52 52 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)) 54 54 frames.append(frame); 55 55 } 56 56 57 57 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())); 59 59 } else { 60 60 // Send events to every page. … … 63 63 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { 64 64 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)) 66 66 frames.append(frame); 67 67 } … … 69 69 70 70 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())); 72 72 } 73 73 } -
trunk/WebKit/chromium/ChangeLog
r53759 r53840 1 2010-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 1 13 2010-01-22 Elliot Glaysher <erg@chromium.org> 2 14 -
trunk/WebKit/chromium/src/StorageAreaProxy.cpp
r53710 r53840 120 120 // Send events only to our page. 121 121 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)) 123 123 frames.append(frame); 124 124 } 125 125 126 126 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())); 128 128 } else { 129 129 // Send events to every page. … … 132 132 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { 133 133 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)) 135 135 frames.append(frame); 136 136 } … … 138 138 139 139 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())); 141 141 } 142 142 }
Note: See TracChangeset
for help on using the changeset viewer.