| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 else if (newValue.isNull()) | 186 else if (newValue.isNull()) |
| 187 frontend()->domStorageItemRemoved(id.release(), key); | 187 frontend()->domStorageItemRemoved(id.release(), key); |
| 188 else if (oldValue.isNull()) | 188 else if (oldValue.isNull()) |
| 189 frontend()->domStorageItemAdded(id.release(), key, newValue); | 189 frontend()->domStorageItemAdded(id.release(), key, newValue); |
| 190 else | 190 else |
| 191 frontend()->domStorageItemUpdated(id.release(), key, oldValue, newValue)
; | 191 frontend()->domStorageItemUpdated(id.release(), key, oldValue, newValue)
; |
| 192 } | 192 } |
| 193 | 193 |
| 194 StorageArea* InspectorDOMStorageAgent::findStorageArea(ErrorString* errorString,
PassOwnPtr<protocol::DOMStorage::StorageId> storageId, LocalFrame*& targetFrame
) | 194 StorageArea* InspectorDOMStorageAgent::findStorageArea(ErrorString* errorString,
PassOwnPtr<protocol::DOMStorage::StorageId> storageId, LocalFrame*& targetFrame
) |
| 195 { | 195 { |
| 196 if (!storageId->hasSecurityOrigin() || !storageId->hasIsLocalStorage()) { | |
| 197 if (errorString) | |
| 198 *errorString = "Invalid storageId format"; | |
| 199 return nullptr; | |
| 200 } | |
| 201 | |
| 202 String securityOrigin = storageId->getSecurityOrigin(); | 196 String securityOrigin = storageId->getSecurityOrigin(); |
| 203 bool isLocalStorage = storageId->getIsLocalStorage(); | 197 bool isLocalStorage = storageId->getIsLocalStorage(); |
| 204 | 198 |
| 205 if (!m_page->mainFrame()->isLocalFrame()) | 199 if (!m_page->mainFrame()->isLocalFrame()) |
| 206 return nullptr; | 200 return nullptr; |
| 207 | 201 |
| 208 OwnPtrWillBeRawPtr<InspectedFrames> inspectedFrames = InspectedFrames::creat
e(m_page->deprecatedLocalMainFrame()); | 202 OwnPtrWillBeRawPtr<InspectedFrames> inspectedFrames = InspectedFrames::creat
e(m_page->deprecatedLocalMainFrame()); |
| 209 LocalFrame* frame = inspectedFrames->frameWithSecurityOrigin(securityOrigin)
; | 203 LocalFrame* frame = inspectedFrames->frameWithSecurityOrigin(securityOrigin)
; |
| 210 if (!frame) { | 204 if (!frame) { |
| 211 if (errorString) | 205 if (errorString) |
| 212 *errorString = "LocalFrame not found for the given security origin"; | 206 *errorString = "LocalFrame not found for the given security origin"; |
| 213 return nullptr; | 207 return nullptr; |
| 214 } | 208 } |
| 215 targetFrame = frame; | 209 targetFrame = frame; |
| 216 | 210 |
| 217 if (isLocalStorage) | 211 if (isLocalStorage) |
| 218 return StorageNamespace::localStorageArea(frame->document()->securityOri
gin()); | 212 return StorageNamespace::localStorageArea(frame->document()->securityOri
gin()); |
| 219 StorageNamespace* sessionStorage = StorageNamespaceController::from(m_page)-
>sessionStorage(); | 213 StorageNamespace* sessionStorage = StorageNamespaceController::from(m_page)-
>sessionStorage(); |
| 220 if (!sessionStorage) { | 214 if (!sessionStorage) { |
| 221 if (errorString) | 215 if (errorString) |
| 222 *errorString = "SessionStorage is not supported"; | 216 *errorString = "SessionStorage is not supported"; |
| 223 return nullptr; | 217 return nullptr; |
| 224 } | 218 } |
| 225 return sessionStorage->storageArea(frame->document()->securityOrigin()); | 219 return sessionStorage->storageArea(frame->document()->securityOrigin()); |
| 226 } | 220 } |
| 227 | 221 |
| 228 } // namespace blink | 222 } // namespace blink |
| OLD | NEW |