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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, true); | 112 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, true); |
113 m_instrumentingAgents->setInspectorDOMStorageAgent(this); | 113 m_instrumentingAgents->setInspectorDOMStorageAgent(this); |
114 } | 114 } |
115 | 115 |
116 void InspectorDOMStorageAgent::disable(ErrorString*) | 116 void InspectorDOMStorageAgent::disable(ErrorString*) |
117 { | 117 { |
118 m_instrumentingAgents->setInspectorDOMStorageAgent(nullptr); | 118 m_instrumentingAgents->setInspectorDOMStorageAgent(nullptr); |
119 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, false); | 119 m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, false); |
120 } | 120 } |
121 | 121 |
122 void InspectorDOMStorageAgent::getDOMStorageItems(ErrorString* errorString, cons
t RefPtr<JSONObject>& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<St
ring> > >& items) | 122 void InspectorDOMStorageAgent::getDOMStorageItems(ErrorString* errorString, cons
t RefPtr<JSONObject>& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<St
ring>>>& items) |
123 { | 123 { |
124 LocalFrame* frame; | 124 LocalFrame* frame; |
125 OwnPtrWillBeRawPtr<StorageArea> storageArea = findStorageArea(errorString, s
torageId, frame); | 125 OwnPtrWillBeRawPtr<StorageArea> storageArea = findStorageArea(errorString, s
torageId, frame); |
126 if (!storageArea) | 126 if (!storageArea) |
127 return; | 127 return; |
128 | 128 |
129 RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageItems = Type
Builder::Array<TypeBuilder::Array<String> >::create(); | 129 RefPtr<TypeBuilder::Array<TypeBuilder::Array<String>>> storageItems = TypeBu
ilder::Array<TypeBuilder::Array<String>>::create(); |
130 | 130 |
131 TrackExceptionState exceptionState; | 131 TrackExceptionState exceptionState; |
132 for (unsigned i = 0; i < storageArea->length(exceptionState, frame); ++i) { | 132 for (unsigned i = 0; i < storageArea->length(exceptionState, frame); ++i) { |
133 String name(storageArea->key(i, exceptionState, frame)); | 133 String name(storageArea->key(i, exceptionState, frame)); |
134 if (hadException(exceptionState, errorString)) | 134 if (hadException(exceptionState, errorString)) |
135 return; | 135 return; |
136 String value(storageArea->getItem(name, exceptionState, frame)); | 136 String value(storageArea->getItem(name, exceptionState, frame)); |
137 if (hadException(exceptionState, errorString)) | 137 if (hadException(exceptionState, errorString)) |
138 return; | 138 return; |
139 RefPtr<TypeBuilder::Array<String> > entry = TypeBuilder::Array<String>::
create(); | 139 RefPtr<TypeBuilder::Array<String>> entry = TypeBuilder::Array<String>::c
reate(); |
140 entry->addItem(name); | 140 entry->addItem(name); |
141 entry->addItem(value); | 141 entry->addItem(value); |
142 storageItems->addItem(entry); | 142 storageItems->addItem(entry); |
143 } | 143 } |
144 items = storageItems.release(); | 144 items = storageItems.release(); |
145 } | 145 } |
146 | 146 |
147 static String toErrorString(ExceptionState& exceptionState) | 147 static String toErrorString(ExceptionState& exceptionState) |
148 { | 148 { |
149 if (exceptionState.hadException()) | 149 if (exceptionState.hadException()) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 targetFrame = frame; | 225 targetFrame = frame; |
226 | 226 |
227 if (isLocalStorage) | 227 if (isLocalStorage) |
228 return StorageNamespace::localStorageArea(frame->document()->securityOri
gin()); | 228 return StorageNamespace::localStorageArea(frame->document()->securityOri
gin()); |
229 return StorageNamespaceController::from(m_pageAgent->page())->sessionStorage
()->storageArea(frame->document()->securityOrigin()); | 229 return StorageNamespaceController::from(m_pageAgent->page())->sessionStorage
()->storageArea(frame->document()->securityOrigin()); |
230 } | 230 } |
231 | 231 |
232 } // namespace blink | 232 } // namespace blink |
233 | 233 |
OLD | NEW |