Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / storage / StorageArea.cpp
index 38a629a..10d6702 100644 (file)
 #include "config.h"
 #include "core/storage/StorageArea.h"
 
-#include "bindings/v8/ExceptionState.h"
+#include "bindings/core/v8/ExceptionState.h"
 #include "core/dom/Document.h"
 #include "core/dom/ExceptionCode.h"
-#include "core/frame/DOMWindow.h"
+#include "core/frame/LocalDOMWindow.h"
 #include "core/frame/LocalFrame.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/page/Page.h"
@@ -43,7 +43,7 @@
 #include "public/platform/WebString.h"
 #include "public/platform/WebURL.h"
 
-namespace WebCore {
+namespace blink {
 
 StorageArea::StorageArea(PassOwnPtr<blink::WebStorageArea> storageArea, StorageType storageType)
     : m_storageArea(storageArea)
@@ -145,9 +145,12 @@ void StorageArea::dispatchLocalStorageEvent(const String& key, const String& old
     // FIXME: This looks suspicious. Why doesn't this use allPages instead?
     const HashSet<Page*>& pages = Page::ordinaryPages();
     for (HashSet<Page*>::const_iterator it = pages.begin(); it != pages.end(); ++it) {
-        for (LocalFrame* frame = (*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+        for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+            // FIXME: We do not yet have a way to dispatch events to out-of-process frames.
+            if (!frame->isLocalFrame())
+                continue;
             Storage* storage = frame->domWindow()->optionalLocalStorage();
-            if (storage && frame->document()->securityOrigin()->canAccess(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
+            if (storage && toLocalFrame(frame)->document()->securityOrigin()->canAccess(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
                 frame->domWindow()->enqueueWindowEvent(StorageEvent::create(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage));
         }
         InspectorInstrumentation::didDispatchDOMStorageEvent(*it, key, oldValue, newValue, LocalStorage, securityOrigin);
@@ -173,9 +176,12 @@ void StorageArea::dispatchSessionStorageEvent(const String& key, const String& o
     if (!page)
         return;
 
-    for (LocalFrame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+        // FIXME: We do not yet have a way to dispatch events to out-of-process frames.
+        if (!frame->isLocalFrame())
+            continue;
         Storage* storage = frame->domWindow()->optionalSessionStorage();
-        if (storage && frame->document()->securityOrigin()->canAccess(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
+        if (storage && toLocalFrame(frame)->document()->securityOrigin()->canAccess(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
             frame->domWindow()->enqueueWindowEvent(StorageEvent::create(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage));
     }
     InspectorInstrumentation::didDispatchDOMStorageEvent(page, key, oldValue, newValue, SessionStorage, securityOrigin);
@@ -188,4 +194,4 @@ bool StorageArea::isEventSource(Storage* storage, blink::WebStorageArea* sourceA
     return area->m_storageArea == sourceAreaInstance;
 }
 
-} // namespace WebCore
+} // namespace blink