| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/inspector/InspectorDOMAgent.h" | 32 #include "core/inspector/InspectorDOMAgent.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
| 35 #include "bindings/core/v8/ScriptEventListener.h" | 35 #include "bindings/core/v8/ScriptEventListener.h" |
| 36 #include "core/InputTypeNames.h" |
| 36 #include "core/dom/Attr.h" | 37 #include "core/dom/Attr.h" |
| 37 #include "core/dom/CharacterData.h" | 38 #include "core/dom/CharacterData.h" |
| 38 #include "core/dom/ContainerNode.h" | 39 #include "core/dom/ContainerNode.h" |
| 39 #include "core/dom/DOMException.h" | 40 #include "core/dom/DOMException.h" |
| 40 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
| 41 #include "core/dom/DocumentFragment.h" | 42 #include "core/dom/DocumentFragment.h" |
| 42 #include "core/dom/DocumentType.h" | 43 #include "core/dom/DocumentType.h" |
| 43 #include "core/dom/Element.h" | 44 #include "core/dom/Element.h" |
| 44 #include "core/dom/Node.h" | 45 #include "core/dom/Node.h" |
| 45 #include "core/dom/PseudoElement.h" | 46 #include "core/dom/PseudoElement.h" |
| (...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 return; | 1445 return; |
| 1445 } | 1446 } |
| 1446 element->focus(); | 1447 element->focus(); |
| 1447 } | 1448 } |
| 1448 | 1449 |
| 1449 void InspectorDOMAgent::setFileInputFiles(ErrorString* errorString, int nodeId,
const RefPtr<JSONArray>& files) | 1450 void InspectorDOMAgent::setFileInputFiles(ErrorString* errorString, int nodeId,
const RefPtr<JSONArray>& files) |
| 1450 { | 1451 { |
| 1451 Node* node = assertNode(errorString, nodeId); | 1452 Node* node = assertNode(errorString, nodeId); |
| 1452 if (!node) | 1453 if (!node) |
| 1453 return; | 1454 return; |
| 1454 if (!isHTMLInputElement(*node) || !toHTMLInputElement(*node).isFileUpload())
{ | 1455 if (!isHTMLInputElement(*node) || toHTMLInputElement(*node).type() != InputT
ypeNames::file) { |
| 1455 *errorString = "Node is not a file input element"; | 1456 *errorString = "Node is not a file input element"; |
| 1456 return; | 1457 return; |
| 1457 } | 1458 } |
| 1458 | 1459 |
| 1459 RefPtrWillBeRawPtr<FileList> fileList = FileList::create(); | 1460 RefPtrWillBeRawPtr<FileList> fileList = FileList::create(); |
| 1460 for (JSONArray::const_iterator iter = files->begin(); iter != files->end();
++iter) { | 1461 for (JSONArray::const_iterator iter = files->begin(); iter != files->end();
++iter) { |
| 1461 String path; | 1462 String path; |
| 1462 if (!(*iter)->asString(&path)) { | 1463 if (!(*iter)->asString(&path)) { |
| 1463 *errorString = "Files must be strings"; | 1464 *errorString = "Files must be strings"; |
| 1464 return; | 1465 return; |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2195 visitor->trace(m_searchResults); | 2196 visitor->trace(m_searchResults); |
| 2196 #endif | 2197 #endif |
| 2197 visitor->trace(m_history); | 2198 visitor->trace(m_history); |
| 2198 visitor->trace(m_domEditor); | 2199 visitor->trace(m_domEditor); |
| 2199 visitor->trace(m_listener); | 2200 visitor->trace(m_listener); |
| 2200 InspectorBaseAgent::trace(visitor); | 2201 InspectorBaseAgent::trace(visitor); |
| 2201 } | 2202 } |
| 2202 | 2203 |
| 2203 } // namespace blink | 2204 } // namespace blink |
| 2204 | 2205 |
| OLD | NEW |