Title: [148219] trunk/Source
Revision
148219
Author
ander...@apple.com
Date
2013-04-11 11:43:40 -0700 (Thu, 11 Apr 2013)

Log Message

Make StorageAreaMap dispatch session storage events
https://bugs.webkit.org/show_bug.cgi?id=114454

Reviewed by Beth Dakin.

Source/WebCore:

Export storage symbols and headers needed by WebKit2.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:

Source/WebKit2:

* WebProcess/Storage/StorageAreaMap.cpp:
(WebKit::StorageAreaMap::dispatchStorageEvent):
Depending on the storage area type, call dispatchSessionStorageEvent or dispatchLocalStorageEvent.

(WebKit::StorageAreaMap::dispatchSessionStorageEvent):
Enumerate all the frames in our page and dispatch the event to the relevant ones.

(WebKit::StorageAreaMap::dispatchLocalStorageEvent):
Add empty stub for now.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148218 => 148219)


--- trunk/Source/WebCore/ChangeLog	2013-04-11 18:39:06 UTC (rev 148218)
+++ trunk/Source/WebCore/ChangeLog	2013-04-11 18:43:40 UTC (rev 148219)
@@ -1,3 +1,15 @@
+2013-04-11  Anders Carlsson  <ander...@apple.com>
+
+        Make StorageAreaMap dispatch session storage events
+        https://bugs.webkit.org/show_bug.cgi?id=114454
+
+        Reviewed by Beth Dakin.
+
+        Export storage symbols and headers needed by WebKit2.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2013-04-11  Allan Sandfeld Jensen  <allan.jen...@digia.com>
 
         handleMouseMoveEvent should let hit-testing hit-test scrollbars

Modified: trunk/Source/WebCore/WebCore.exp.in (148218 => 148219)


--- trunk/Source/WebCore/WebCore.exp.in	2013-04-11 18:39:06 UTC (rev 148218)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-04-11 18:43:40 UTC (rev 148219)
@@ -702,6 +702,7 @@
 __ZN7WebCore22systemMarketingVersionEv
 __ZN7WebCore22userPreferredLanguagesEv
 __ZN7WebCore22HTMLPlugInImageElement29setIsPrimarySnapshottedPlugInEb
+__ZN7WebCore22StorageEventDispatcher34dispatchLocalStorageEventsToFramesERNS_9PageGroupERKN3WTF6VectorINS3_6RefPtrINS_5FrameEEELm0ENS3_15CrashOnOverflowEEERKNS3_6StringESE_SE_SE_PNS_14SecurityOriginE
 __ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
 __ZN7WebCore23ApplicationCacheStorage16deleteAllEntriesEv
 __ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKN3WTF6StringEPNS_20ApplicationCacheHostE

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (148218 => 148219)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-04-11 18:39:06 UTC (rev 148218)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2013-04-11 18:43:40 UTC (rev 148219)
@@ -557,6 +557,7 @@
 		1ABC7109170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABC7108170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h */; };
 		1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; };
 		1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; };
+		1AC2D845171734A100652FC0 /* Storage.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E3F9C40DA059DC00250911 /* Storage.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AC69593161A1E53003732CB /* GraphicsLayerFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC69592161A1E53003732CB /* GraphicsLayerFactory.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1ACD1B630B029739007E5016 /* DOMCSSStyleDeclarationInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E711440AC5D5340053270F /* DOMCSSStyleDeclarationInternal.h */; };
 		1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */; };
@@ -5168,7 +5169,7 @@
 		C5B4C24E1509236C00A6EF37 /* WebCoreNSURLExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5B4C24C1509236C00A6EF37 /* WebCoreNSURLExtras.mm */; };
 		C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		C5E9B67710697E1300C7BB1A /* StorageEventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */; };
-		C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; };
+		C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		C65046A9167BFB5500CC2A4D /* TemplateContentDocumentFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = C65046A8167BFB5500CC2A4D /* TemplateContentDocumentFragment.h */; };
 		C6A703325C9D0B6CDCBC4D77 /* JSEventTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6A703325C9D0B6CDCBC4D78 /* JSEventTarget.cpp */; };
 		C6B31B2E14F841FB0089F23F /* ScrollbarThemeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C691614714F6EBA70046375C /* ScrollbarThemeClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -23950,6 +23951,7 @@
 				97AABD2B14FA09D5007457AE /* WebSocketHandshakeResponse.h in Headers */,
 				0F580FA31496939100FB5BD8 /* WebTiledBackingLayer.h in Headers */,
 				0FCF332D0F2B9A25004B6795 /* WebTiledLayer.h in Headers */,
+				1AC2D845171734A100652FC0 /* Storage.h in Headers */,
 				CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */,
 				CD82030C1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h in Headers */,
 				F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */,

Modified: trunk/Source/WebKit2/ChangeLog (148218 => 148219)


--- trunk/Source/WebKit2/ChangeLog	2013-04-11 18:39:06 UTC (rev 148218)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-11 18:43:40 UTC (rev 148219)
@@ -1,5 +1,22 @@
 2013-04-11  Anders Carlsson  <ander...@apple.com>
 
+        Make StorageAreaMap dispatch session storage events
+        https://bugs.webkit.org/show_bug.cgi?id=114454
+
+        Reviewed by Beth Dakin.
+
+        * WebProcess/Storage/StorageAreaMap.cpp:
+        (WebKit::StorageAreaMap::dispatchStorageEvent):
+        Depending on the storage area type, call dispatchSessionStorageEvent or dispatchLocalStorageEvent.
+
+        (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
+        Enumerate all the frames in our page and dispatch the event to the relevant ones.
+
+        (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
+        Add empty stub for now.
+
+2013-04-11  Anders Carlsson  <ander...@apple.com>
+
         Implement more logic in StorageAreaMap
         https://bugs.webkit.org/show_bug.cgi?id=114451
 

Modified: trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp (148218 => 148219)


--- trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp	2013-04-11 18:39:06 UTC (rev 148218)
+++ trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.cpp	2013-04-11 18:43:40 UTC (rev 148219)
@@ -31,8 +31,12 @@
 #include "StorageAreaMapMessages.h"
 #include "StorageManagerMessages.h"
 #include "StorageNamespaceImpl.h"
+#include "WebPage.h"
 #include "WebProcess.h"
 #include <WebCore/Frame.h>
+#include <WebCore/Page.h>
+#include <WebCore/Storage.h>
+#include <WebCore/StorageEventDispatcher.h>
 #include <WebCore/StorageMap.h>
 
 using namespace WebCore;
@@ -145,7 +149,54 @@
 
 void StorageAreaMap::dispatchStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString)
 {
-    // FIXME: Implement.
+    if (storageType() == SessionStorage)
+        dispatchSessionStorageEvent(sourceStorageAreaID, key, oldValue, newValue, urlString);
+    else
+        dispatchLocalStorageEvent(sourceStorageAreaID, key, oldValue, newValue, urlString);
 }
 
+void StorageAreaMap::dispatchSessionStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString)
+{
+    ASSERT(storageType() == SessionStorage);
+
+    // Namespace IDs for session storage namespaces are equivalent to web page IDs
+    // so we can get the right page here.
+    WebPage* webPage = WebProcess::shared().webPage(m_storageNamespaceID);
+    if (!webPage)
+        return;
+
+    Vector<RefPtr<Frame> > frames;
+
+    Page* page = webPage->corePage();
+    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+        Document* document = frame->document();
+        if (!document->securityOrigin()->equal(m_securityOrigin.get()))
+            continue;
+
+        Storage* storage = document->domWindow()->optionalSessionStorage();
+        if (!storage)
+            continue;
+
+        StorageAreaImpl* storageArea = static_cast<StorageAreaImpl*>(storage->area());
+        if (storageArea->storageAreaID() == sourceStorageAreaID) {
+            // This is the storage area that caused the event to be dispatched.
+            continue;
+        }
+
+        frames.append(frame);
+    }
+
+    StorageEventDispatcher::dispatchLocalStorageEventsToFrames(page->group(), frames, key, oldValue, newValue, urlString, m_securityOrigin.get());
+}
+
+void StorageAreaMap::dispatchLocalStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString)
+{
+    ASSERT(storageType() == LocalStorage);
+
+    UNUSED_PARAM(key);
+    UNUSED_PARAM(oldValue);
+    UNUSED_PARAM(newValue);
+    UNUSED_PARAM(urlString);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.h (148218 => 148219)


--- trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.h	2013-04-11 18:39:06 UTC (rev 148218)
+++ trunk/Source/WebKit2/WebProcess/Storage/StorageAreaMap.h	2013-04-11 18:43:40 UTC (rev 148219)
@@ -68,6 +68,9 @@
 
     void loadValuesIfNeeded();
 
+    void dispatchSessionStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString);
+    void dispatchLocalStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString);
+
     uint64_t m_storageMapID;
     uint64_t m_storageNamespaceID;
     unsigned m_quotaInBytes;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to