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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 const String& key, | 162 const String& key, |
163 const String& oldValue, | 163 const String& oldValue, |
164 const String& newValue, | 164 const String& newValue, |
165 SecurityOrigin* securityOrigin, | 165 SecurityOrigin* securityOrigin, |
166 const KURL& pageURL, | 166 const KURL& pageURL, |
167 WebStorageArea* sourceAreaInstance) { | 167 WebStorageArea* sourceAreaInstance) { |
168 // Iterate over all pages that have a StorageNamespaceController supplement. | 168 // Iterate over all pages that have a StorageNamespaceController supplement. |
169 for (Page* page : Page::ordinaryPages()) { | 169 for (Page* page : Page::ordinaryPages()) { |
170 for (Frame* frame = page->mainFrame(); frame; | 170 for (Frame* frame = page->mainFrame(); frame; |
171 frame = frame->tree().traverseNext()) { | 171 frame = frame->tree().traverseNext()) { |
172 // FIXME: We do not yet have a way to dispatch events to out-of-process fr
ames. | 172 // FIXME: We do not yet have a way to dispatch events to out-of-process |
| 173 // frames. |
173 if (!frame->isLocalFrame()) | 174 if (!frame->isLocalFrame()) |
174 continue; | 175 continue; |
175 LocalFrame* localFrame = toLocalFrame(frame); | 176 LocalFrame* localFrame = toLocalFrame(frame); |
176 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); | 177 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); |
177 Storage* storage = | 178 Storage* storage = |
178 DOMWindowStorage::from(*localWindow).optionalLocalStorage(); | 179 DOMWindowStorage::from(*localWindow).optionalLocalStorage(); |
179 if (storage && | 180 if (storage && |
180 localFrame->document()->getSecurityOrigin()->canAccess( | 181 localFrame->document()->getSecurityOrigin()->canAccess( |
181 securityOrigin) && | 182 securityOrigin) && |
182 !isEventSource(storage, sourceAreaInstance)) | 183 !isEventSource(storage, sourceAreaInstance)) |
(...skipping 29 matching lines...) Expand all Loading... |
212 SecurityOrigin* securityOrigin, | 213 SecurityOrigin* securityOrigin, |
213 const KURL& pageURL, | 214 const KURL& pageURL, |
214 const WebStorageNamespace& sessionNamespace, | 215 const WebStorageNamespace& sessionNamespace, |
215 WebStorageArea* sourceAreaInstance) { | 216 WebStorageArea* sourceAreaInstance) { |
216 Page* page = findPageWithSessionStorageNamespace(sessionNamespace); | 217 Page* page = findPageWithSessionStorageNamespace(sessionNamespace); |
217 if (!page) | 218 if (!page) |
218 return; | 219 return; |
219 | 220 |
220 for (Frame* frame = page->mainFrame(); frame; | 221 for (Frame* frame = page->mainFrame(); frame; |
221 frame = frame->tree().traverseNext()) { | 222 frame = frame->tree().traverseNext()) { |
222 // FIXME: We do not yet have a way to dispatch events to out-of-process fram
es. | 223 // FIXME: We do not yet have a way to dispatch events to out-of-process |
| 224 // frames. |
223 if (!frame->isLocalFrame()) | 225 if (!frame->isLocalFrame()) |
224 continue; | 226 continue; |
225 LocalFrame* localFrame = toLocalFrame(frame); | 227 LocalFrame* localFrame = toLocalFrame(frame); |
226 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); | 228 LocalDOMWindow* localWindow = localFrame->localDOMWindow(); |
227 Storage* storage = | 229 Storage* storage = |
228 DOMWindowStorage::from(*localWindow).optionalSessionStorage(); | 230 DOMWindowStorage::from(*localWindow).optionalSessionStorage(); |
229 if (storage && | 231 if (storage && |
230 localFrame->document()->getSecurityOrigin()->canAccess( | 232 localFrame->document()->getSecurityOrigin()->canAccess( |
231 securityOrigin) && | 233 securityOrigin) && |
232 !isEventSource(storage, sourceAreaInstance)) | 234 !isEventSource(storage, sourceAreaInstance)) |
233 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::create( | 235 localFrame->localDOMWindow()->enqueueWindowEvent(StorageEvent::create( |
234 EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); | 236 EventTypeNames::storage, key, oldValue, newValue, pageURL, storage)); |
235 } | 237 } |
236 if (InspectorDOMStorageAgent* agent = | 238 if (InspectorDOMStorageAgent* agent = |
237 StorageNamespaceController::from(page)->inspectorAgent()) | 239 StorageNamespaceController::from(page)->inspectorAgent()) |
238 agent->didDispatchDOMStorageEvent(key, oldValue, newValue, SessionStorage, | 240 agent->didDispatchDOMStorageEvent(key, oldValue, newValue, SessionStorage, |
239 securityOrigin); | 241 securityOrigin); |
240 } | 242 } |
241 | 243 |
242 bool StorageArea::isEventSource(Storage* storage, | 244 bool StorageArea::isEventSource(Storage* storage, |
243 WebStorageArea* sourceAreaInstance) { | 245 WebStorageArea* sourceAreaInstance) { |
244 ASSERT(storage); | 246 ASSERT(storage); |
245 StorageArea* area = storage->area(); | 247 StorageArea* area = storage->area(); |
246 return area->m_storageArea.get() == sourceAreaInstance; | 248 return area->m_storageArea.get() == sourceAreaInstance; |
247 } | 249 } |
248 | 250 |
249 } // namespace blink | 251 } // namespace blink |
OLD | NEW |