| 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 22 matching lines...) Expand all Loading... |
| 33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
| 34 #include "core/InspectorFrontend.h" | 34 #include "core/InspectorFrontend.h" |
| 35 #include "core/dom/DOMException.h" | 35 #include "core/dom/DOMException.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
| 38 #include "core/inspector/InspectorPageAgent.h" | 38 #include "core/inspector/InspectorPageAgent.h" |
| 39 #include "core/inspector/InspectorState.h" | 39 #include "core/inspector/InspectorState.h" |
| 40 #include "core/inspector/InstrumentingAgents.h" | 40 #include "core/inspector/InstrumentingAgents.h" |
| 41 #include "core/frame/LocalDOMWindow.h" | 41 #include "core/frame/LocalDOMWindow.h" |
| 42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
| 43 #include "core/page/Page.h" | |
| 44 #include "core/storage/Storage.h" | 43 #include "core/storage/Storage.h" |
| 45 #include "core/storage/StorageNamespace.h" | 44 #include "core/storage/StorageNamespace.h" |
| 46 #include "core/storage/StorageNamespaceController.h" | 45 #include "core/storage/StorageNamespaceController.h" |
| 47 #include "platform/JSONValues.h" | 46 #include "platform/JSONValues.h" |
| 48 #include "platform/weborigin/SecurityOrigin.h" | 47 #include "platform/weborigin/SecurityOrigin.h" |
| 49 | 48 |
| 50 namespace blink { | 49 namespace blink { |
| 51 | 50 |
| 52 namespace DOMStorageAgentState { | 51 namespace DOMStorageAgentState { |
| 53 static const char domStorageAgentEnabled[] = "domStorageAgentEnabled"; | 52 static const char domStorageAgentEnabled[] = "domStorageAgentEnabled"; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 *errorString = toErrorString(exceptionState); | 178 *errorString = toErrorString(exceptionState); |
| 180 } | 179 } |
| 181 | 180 |
| 182 PassRefPtr<TypeBuilder::DOMStorage::StorageId> InspectorDOMStorageAgent::storage
Id(SecurityOrigin* securityOrigin, bool isLocalStorage) | 181 PassRefPtr<TypeBuilder::DOMStorage::StorageId> InspectorDOMStorageAgent::storage
Id(SecurityOrigin* securityOrigin, bool isLocalStorage) |
| 183 { | 182 { |
| 184 return TypeBuilder::DOMStorage::StorageId::create() | 183 return TypeBuilder::DOMStorage::StorageId::create() |
| 185 .setSecurityOrigin(securityOrigin->toRawString()) | 184 .setSecurityOrigin(securityOrigin->toRawString()) |
| 186 .setIsLocalStorage(isLocalStorage).release(); | 185 .setIsLocalStorage(isLocalStorage).release(); |
| 187 } | 186 } |
| 188 | 187 |
| 189 void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String& key, con
st String& oldValue, const String& newValue, StorageType storageType, SecurityOr
igin* securityOrigin) | 188 void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(LocalFrame* frame, con
st String& key, const String& oldValue, const String& newValue, StorageType stor
ageType, SecurityOrigin* securityOrigin) |
| 190 { | 189 { |
| 191 if (!m_frontend || !isEnabled()) | 190 if (!m_frontend || !isEnabled() || frame != m_pageAgent->inspectedFrame()) |
| 192 return; | 191 return; |
| 193 | 192 |
| 194 RefPtr<TypeBuilder::DOMStorage::StorageId> id = storageId(securityOrigin, st
orageType == LocalStorage); | 193 RefPtr<TypeBuilder::DOMStorage::StorageId> id = storageId(securityOrigin, st
orageType == LocalStorage); |
| 195 | 194 |
| 196 if (key.isNull()) | 195 if (key.isNull()) |
| 197 m_frontend->domStorageItemsCleared(id); | 196 m_frontend->domStorageItemsCleared(id); |
| 198 else if (newValue.isNull()) | 197 else if (newValue.isNull()) |
| 199 m_frontend->domStorageItemRemoved(id, key); | 198 m_frontend->domStorageItemRemoved(id, key); |
| 200 else if (oldValue.isNull()) | 199 else if (oldValue.isNull()) |
| 201 m_frontend->domStorageItemAdded(id, key, newValue); | 200 m_frontend->domStorageItemAdded(id, key, newValue); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 219 LocalFrame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin)
; | 218 LocalFrame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin)
; |
| 220 if (!frame) { | 219 if (!frame) { |
| 221 if (errorString) | 220 if (errorString) |
| 222 *errorString = "LocalFrame not found for the given security origin"; | 221 *errorString = "LocalFrame not found for the given security origin"; |
| 223 return nullptr; | 222 return nullptr; |
| 224 } | 223 } |
| 225 targetFrame = frame; | 224 targetFrame = frame; |
| 226 | 225 |
| 227 if (isLocalStorage) | 226 if (isLocalStorage) |
| 228 return StorageNamespace::localStorageArea(frame->document()->securityOri
gin()); | 227 return StorageNamespace::localStorageArea(frame->document()->securityOri
gin()); |
| 229 return StorageNamespaceController::from(m_pageAgent->page())->sessionStorage
()->storageArea(frame->document()->securityOrigin()); | 228 return StorageNamespaceController::from(frame->page())->sessionStorage()->st
orageArea(frame->document()->securityOrigin()); |
| 230 } | 229 } |
| 231 | 230 |
| 232 } // namespace blink | 231 } // namespace blink |
| 233 | 232 |
| OLD | NEW |