WebKit Bugzilla
Attachment 357093 Details for
Bug 192608
: [iOS] A few API tests are failing after r239086
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes the tests
bug-192608-20181211174024.patch (text/plain), 4.67 KB, created by
Wenson Hsieh
on 2018-12-11 17:40:25 PST
(
hide
)
Description:
Fixes the tests
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-12-11 17:40:25 PST
Size:
4.67 KB
patch
obsolete
>Subversion Revision: 239090 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a1e98b108d56a700d3a0b879771aee9b34cc2a20..dbc144c280450e6baa2b46574e1d8475d275feee 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-12-11 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] A few API tests are failing after r239086 >+ https://bugs.webkit.org/show_bug.cgi?id=192608 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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): >+ > 2018-12-11 Brent Fulgham <bfulgham@apple.com> > > Don't attempt to compute animated values when there is no relevant animation >diff --git a/Source/WebCore/platform/PasteboardItemInfo.h b/Source/WebCore/platform/PasteboardItemInfo.h >index 3bc56848430c53541e3674ed1ddea126101eb9a5..d627df45e4121cd572f7e96cd081f209fc49eebe 100644 >--- a/Source/WebCore/platform/PasteboardItemInfo.h >+++ b/Source/WebCore/platform/PasteboardItemInfo.h >@@ -55,6 +55,15 @@ struct PasteboardItemInfo { > return pathsForFileUpload[index]; > } > >+ String pathForHighestFidelityItem() const >+ { >+ if (pathsForFileUpload.isEmpty()) >+ return { }; >+ >+ ASSERT(!pathsForFileUpload.first().isEmpty()); >+ return pathsForFileUpload.first(); >+ } >+ > template<class Encoder> void encode(Encoder&) const; > template<class Decoder> static std::optional<PasteboardItemInfo> decode(Decoder&); > }; >diff --git a/Source/WebCore/platform/ios/PasteboardIOS.mm b/Source/WebCore/platform/ios/PasteboardIOS.mm >index 1d9b05788c6c6084b36e76e55026c751fe23e241..31964ffcc1968d5d81bd49896c81dd4aa24e29d9 100644 >--- a/Source/WebCore/platform/ios/PasteboardIOS.mm >+++ b/Source/WebCore/platform/ios/PasteboardIOS.mm >@@ -294,9 +294,10 @@ void Pasteboard::readRespectingUTIFidelities(PasteboardWebContentReader& reader, > for (NSUInteger index = 0, numberOfItems = strategy.getPasteboardItemsCount(m_pasteboardName); index < numberOfItems; ++index) { > #if ENABLE(ATTACHMENT_ELEMENT) > auto info = strategy.informationForItemAtIndex(index, m_pasteboardName); >- bool canReadAttachment = policy == WebContentReadingPolicy::AnyType && RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled() && !info.pathsForFileUpload.isEmpty(); >+ auto attachmentFilePath = info.pathForHighestFidelityItem(); >+ bool canReadAttachment = policy == WebContentReadingPolicy::AnyType && RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled() && !attachmentFilePath.isEmpty(); > if (canReadAttachment && info.preferredPresentationStyle == PasteboardItemPresentationStyle::Attachment) { >- reader.readFilePaths({ info.pathsForFileUpload.first() }); >+ reader.readFilePaths({ WTFMove(attachmentFilePath) }); > continue; > } > #endif >@@ -317,7 +318,7 @@ void Pasteboard::readRespectingUTIFidelities(PasteboardWebContentReader& reader, > } > #if ENABLE(ATTACHMENT_ELEMENT) > if (canReadAttachment && result == ReaderResult::DidNotReadType) >- reader.readFilePaths({ info.pathsForFileUpload.first() }); >+ reader.readFilePaths({ WTFMove(attachmentFilePath) }); > #endif > } > } >@@ -459,7 +460,7 @@ Vector<String> Pasteboard::readFilePaths() > auto& strategy = *platformStrategies()->pasteboardStrategy(); > for (NSUInteger index = 0, numberOfItems = strategy.getPasteboardItemsCount(m_pasteboardName); index < numberOfItems; ++index) { > // Currently, drag and drop is the only case on iOS where the "pasteboard" may contain file paths. >- auto filePath = strategy.informationForItemAtIndex(index, m_pasteboardName).pathsForFileUpload.first(); >+ auto filePath = strategy.informationForItemAtIndex(index, m_pasteboardName).pathForHighestFidelityItem(); > if (!filePath.isEmpty()) > filePaths.append(WTFMove(filePath)); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192608
: 357093