Changeset 141690 in webkit
- Timestamp:
- Feb 2, 2013 4:54:34 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r141689 r141690 1 2013-02-02 Vivek Galatage <vivek.vg@samsung.com> 2 3 Web Inspector: Refactor InspectorDOMStorageAgent::getDOMStorageEntries to report the error messages 4 https://bugs.webkit.org/show_bug.cgi?id=108611 5 6 Reviewed by Pavel Feldman. 7 8 Added reporting of various error messages. Moved the modification of output 9 parameter at a later stage when there are no errors reported. 10 11 No new tests as code refactoring. 12 13 * inspector/InspectorDOMStorageAgent.cpp: 14 (WebCore::hadException): 15 (WebCore): 16 (WebCore::InspectorDOMStorageAgent::getDOMStorageEntries): 17 1 18 2013-02-02 Andrey Lushnikov <lushnikov@chromium.org> 2 19 -
trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
r141570 r141690 57 57 }; 58 58 59 static bool hadException(ExceptionCode ec, ErrorString* errorString) 60 { 61 switch (ec) { 62 case 0: 63 return false; 64 case SECURITY_ERR: 65 *errorString = "Security error"; 66 return true; 67 default: 68 *errorString = "Unknown DOM storage error"; 69 return true; 70 } 71 } 72 59 73 InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* state) 60 74 : InspectorBaseAgent<InspectorDOMStorageAgent>("DOMStorage", instrumentingAgents, state) … … 110 124 } 111 125 112 void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, const String& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& entries) 113 { 114 // FIXME: consider initializing this array after 2 checks below. The checks should return error messages in this case. 115 entries = TypeBuilder::Array<TypeBuilder::Array<String> >::create(); 116 126 void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString* errorString, const String& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& entries) 127 { 117 128 InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId); 118 if (!storageResource) 119 return; 129 if (!storageResource) { 130 *errorString = "Storage resource not found for the given storage identifier"; 131 return; 132 } 120 133 Frame* frame = storageResource->frame(); 121 if (!frame) 122 return; 123 124 // FIXME: Exceptions are not reported here. 134 if (!frame) { 135 *errorString = "Frame not found"; 136 return; 137 } 138 139 RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageEntries = TypeBuilder::Array<TypeBuilder::Array<String> >::create(); 140 125 141 ExceptionCode ec = 0; 126 142 StorageArea* storageArea = storageResource->storageArea(); 127 143 for (unsigned i = 0; i < storageArea->length(ec, frame); ++i) { 128 144 String name(storageArea->key(i, ec, frame)); 129 if ( ec)145 if (hadException(ec, errorString)) 130 146 return; 131 147 String value(storageArea->getItem(name, ec, frame)); 132 if ( ec)148 if (hadException(ec, errorString)) 133 149 return; 134 150 RefPtr<TypeBuilder::Array<String> > entry = TypeBuilder::Array<String>::create(); 135 151 entry->addItem(name); 136 152 entry->addItem(value); 137 entries->addItem(entry); 138 } 153 storageEntries->addItem(entry); 154 } 155 entries = storageEntries.release(); 139 156 } 140 157
Note: See TracChangeset
for help on using the changeset viewer.