| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Google Inc. All Rights Reserved. |
| 3 * (C) 2008 Apple Inc. | 3 * (C) 2008 Apple Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 for (Page* page : pages) { | 167 for (Page* page : pages) { |
| 168 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().trav
erseNext()) { | 168 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().trav
erseNext()) { |
| 169 // FIXME: We do not yet have a way to dispatch events to out-of-proc
ess frames. | 169 // FIXME: We do not yet have a way to dispatch events to out-of-proc
ess frames. |
| 170 if (!frame->isLocalFrame()) | 170 if (!frame->isLocalFrame()) |
| 171 continue; | 171 continue; |
| 172 LocalFrame* localFrame = toLocalFrame(frame); | 172 LocalFrame* localFrame = toLocalFrame(frame); |
| 173 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); | 173 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); |
| 174 Storage* storage = DOMWindowStorage::from(*localWindow).optionalLoca
lStorage(); | 174 Storage* storage = DOMWindowStorage::from(*localWindow).optionalLoca
lStorage(); |
| 175 if (storage && localFrame->document()->securityOrigin()->canAccess(s
ecurityOrigin) && !isEventSource(storage, sourceAreaInstance)) | 175 if (storage && localFrame->document()->securityOrigin()->canAccess(s
ecurityOrigin) && !isEventSource(storage, sourceAreaInstance)) |
| 176 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::c
reate(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); | 176 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::c
reate(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); |
| 177 InspectorInstrumentation::didDispatchDOMStorageEvent(localFrame, key
, oldValue, newValue, LocalStorage, securityOrigin); |
| 177 } | 178 } |
| 178 InspectorInstrumentation::didDispatchDOMStorageEvent(page, key, oldValue
, newValue, LocalStorage, securityOrigin); | |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 static Page* findPageWithSessionStorageNamespace(const WebStorageNamespace& sess
ionNamespace) | 182 static Page* findPageWithSessionStorageNamespace(const WebStorageNamespace& sess
ionNamespace) |
| 183 { | 183 { |
| 184 // FIXME: This looks suspicious. Why doesn't this use allPages instead? | 184 // FIXME: This looks suspicious. Why doesn't this use allPages instead? |
| 185 const HashSet<Page*>& pages = Page::ordinaryPages(); | 185 const HashSet<Page*>& pages = Page::ordinaryPages(); |
| 186 for (Page* page : pages) { | 186 for (Page* page : pages) { |
| 187 const bool dontCreateIfMissing = false; | 187 const bool dontCreateIfMissing = false; |
| 188 StorageNamespace* storageNamespace = StorageNamespaceController::from(pa
ge)->sessionStorage(dontCreateIfMissing); | 188 StorageNamespace* storageNamespace = StorageNamespaceController::from(pa
ge)->sessionStorage(dontCreateIfMissing); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 200 | 200 |
| 201 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverse
Next()) { | 201 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverse
Next()) { |
| 202 // FIXME: We do not yet have a way to dispatch events to out-of-process
frames. | 202 // FIXME: We do not yet have a way to dispatch events to out-of-process
frames. |
| 203 if (!frame->isLocalFrame()) | 203 if (!frame->isLocalFrame()) |
| 204 continue; | 204 continue; |
| 205 LocalFrame* localFrame = toLocalFrame(frame); | 205 LocalFrame* localFrame = toLocalFrame(frame); |
| 206 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); | 206 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); |
| 207 Storage* storage = DOMWindowStorage::from(*localWindow).optionalSessionS
torage(); | 207 Storage* storage = DOMWindowStorage::from(*localWindow).optionalSessionS
torage(); |
| 208 if (storage && localFrame->document()->securityOrigin()->canAccess(secur
ityOrigin) && !isEventSource(storage, sourceAreaInstance)) | 208 if (storage && localFrame->document()->securityOrigin()->canAccess(secur
ityOrigin) && !isEventSource(storage, sourceAreaInstance)) |
| 209 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::creat
e(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); | 209 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::creat
e(EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); |
| 210 InspectorInstrumentation::didDispatchDOMStorageEvent(localFrame, key, ol
dValue, newValue, SessionStorage, securityOrigin); |
| 210 } | 211 } |
| 211 InspectorInstrumentation::didDispatchDOMStorageEvent(page, key, oldValue, ne
wValue, SessionStorage, securityOrigin); | |
| 212 } | 212 } |
| 213 | 213 |
| 214 bool StorageArea::isEventSource(Storage* storage, WebStorageArea* sourceAreaInst
ance) | 214 bool StorageArea::isEventSource(Storage* storage, WebStorageArea* sourceAreaInst
ance) |
| 215 { | 215 { |
| 216 ASSERT(storage); | 216 ASSERT(storage); |
| 217 StorageArea* area = storage->area(); | 217 StorageArea* area = storage->area(); |
| 218 return area->m_storageArea == sourceAreaInstance; | 218 return area->m_storageArea == sourceAreaInstance; |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace blink | 221 } // namespace blink |
| OLD | NEW |