[iOS] A few API tests are failing after r239086
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2018 17:06:49 +0000 (17:06 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2018 17:06:49 +0000 (17:06 +0000)
commit534ad3f1a6093312b4df531037c6a48a3d6482ca
tree8acd2806a66624cf9368691f2b55c142fc670679
parentdec75da3cc1a6c06f7a039bcbf30c5f112652f0e
[iOS] A few API tests are failing after r239086
https://bugs.webkit.org/show_bug.cgi?id=192608

Reviewed by Zalan Bujtas.

These test failures were caused by a missing Vector size check in `Pasteboard::readFilePaths` before accessing
the first item. Fix this by adding a helper method on PasteboardItemInfo to grab the file path for the highest
fidelity pasteboard item (returning the null string if there are none), and use this in a few places that grab
the highest fidelity path using Vector::first().

While `Pasteboard::readRespectingUTIFidelities` does have a bounds check before accessing the list of paths,
this patch still replaces it with a call to `pathForHighestFidelityItem()`, so that the intent is more clear.

* platform/PasteboardItemInfo.h:
(WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::readRespectingUTIFidelities):
(WebCore::Pasteboard::readFilePaths):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239107 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/PasteboardItemInfo.h
Source/WebCore/platform/ios/PasteboardIOS.mm