OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/test_runner/event_sender.h" | 5 #include "components/test_runner/event_sender.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 SavedEvent saved_event; | 1838 SavedEvent saved_event; |
1839 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; | 1839 saved_event.type = SavedEvent::TYPE_LEAP_FORWARD; |
1840 saved_event.milliseconds = milliseconds; | 1840 saved_event.milliseconds = milliseconds; |
1841 mouse_event_queue_.push_back(saved_event); | 1841 mouse_event_queue_.push_back(saved_event); |
1842 } else { | 1842 } else { |
1843 DoLeapForward(milliseconds); | 1843 DoLeapForward(milliseconds); |
1844 } | 1844 } |
1845 } | 1845 } |
1846 | 1846 |
1847 void EventSender::BeginDragWithFiles(const std::vector<std::string>& files) { | 1847 void EventSender::BeginDragWithFiles(const std::vector<std::string>& files) { |
| 1848 if (!current_drag_data_.isNull()) { |
| 1849 // Nested dragging not supported, fuzzer code a likely culprit. |
| 1850 // Cancel the current drag operation and throw an error. |
| 1851 KeyDown("escape", 0, DOMKeyLocationStandard); |
| 1852 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 1853 isolate->ThrowException(v8::Exception::Error( |
| 1854 gin::StringToV8(isolate, |
| 1855 "Nested beginDragWithFiles() not supported."))); |
| 1856 return; |
| 1857 } |
1848 current_drag_data_.initialize(); | 1858 current_drag_data_.initialize(); |
1849 WebVector<WebString> absolute_filenames(files.size()); | 1859 WebVector<WebString> absolute_filenames(files.size()); |
1850 for (size_t i = 0; i < files.size(); ++i) { | 1860 for (size_t i = 0; i < files.size(); ++i) { |
1851 WebDragData::Item item; | 1861 WebDragData::Item item; |
1852 item.storageType = WebDragData::Item::StorageTypeFilename; | 1862 item.storageType = WebDragData::Item::StorageTypeFilename; |
1853 item.filenameData = delegate_->GetAbsoluteWebStringFromUTF8Path(files[i]); | 1863 item.filenameData = delegate_->GetAbsoluteWebStringFromUTF8Path(files[i]); |
1854 current_drag_data_.addItem(item); | 1864 current_drag_data_.addItem(item); |
1855 absolute_filenames[i] = item.filenameData; | 1865 absolute_filenames[i] = item.filenameData; |
1856 } | 1866 } |
1857 current_drag_data_.setFilesystemId( | 1867 current_drag_data_.setFilesystemId( |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 last_event_timestamp_ = event.timeStampSeconds; | 2659 last_event_timestamp_ = event.timeStampSeconds; |
2650 | 2660 |
2651 if (WebPagePopup* popup = view_->pagePopup()) { | 2661 if (WebPagePopup* popup = view_->pagePopup()) { |
2652 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2662 if (!WebInputEvent::isKeyboardEventType(event.type)) |
2653 return popup->handleInputEvent(event); | 2663 return popup->handleInputEvent(event); |
2654 } | 2664 } |
2655 return view_->handleInputEvent(event); | 2665 return view_->handleInputEvent(event); |
2656 } | 2666 } |
2657 | 2667 |
2658 } // namespace test_runner | 2668 } // namespace test_runner |
OLD | NEW |