WebKit Bugzilla
Attachment 348401 Details for
Bug 189080
: Use the null string instead of std::nullopt for missing attachment file names and content types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189080-20180829083916.patch (text/plain), 8.51 KB, created by
Wenson Hsieh
on 2018-08-29 08:39:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-08-29 08:39:17 PDT
Size:
8.51 KB
patch
obsolete
>Subversion Revision: 235441 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d32b1dc07369d47866848d155dce693de9aeed4e..db3315504c8ed1fc3d03416bc3932df5d01a99f0 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-08-29 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Use the null string instead of std::nullopt for missing attachment file names and content types >+ https://bugs.webkit.org/show_bug.cgi?id=189080 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Replace instances of std::optional<String> with just String instead, and use the null string to represent a >+ missing value instead of std::nullopt. No change in behavior. >+ >+ * html/HTMLAttachmentElement.cpp: >+ (WebCore::HTMLAttachmentElement::updateAttributes): >+ * html/HTMLAttachmentElement.h: >+ > 2018-08-28 Youenn Fablet <youenn@apple.com> > > MediaDevices should be collectable as soon as its document is stopped >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 108fc7a264649488a9841921eb0b5c3b8a6e9da5..8c086fb4670dabfd6da0f56690a83528007f2004 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2018-08-29 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Use the null string instead of std::nullopt for missing attachment file names and content types >+ https://bugs.webkit.org/show_bug.cgi?id=189080 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Replace instances of std::optional<String> with just String instead, and use the null string to represent a >+ missing value instead of std::nullopt. No change in behavior. >+ >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::updateAttachmentAttributes): >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::updateAttachmentAttributes): >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ > 2018-08-28 Sihui Liu <sihui_liu@apple.com> > > Add error information to help debug test failure in WKNavigation.ProcessCrashDuringCallback >diff --git a/Source/WebCore/html/HTMLAttachmentElement.cpp b/Source/WebCore/html/HTMLAttachmentElement.cpp >index 3edbc51dad889ef6f8304b021a1d5254ca7cd866..6d1b2d12b91c5cef1564f003290c9e29c854b5d0 100644 >--- a/Source/WebCore/html/HTMLAttachmentElement.cpp >+++ b/Source/WebCore/html/HTMLAttachmentElement.cpp >@@ -144,15 +144,15 @@ String HTMLAttachmentElement::attachmentPath() const > return attributeWithoutSynchronization(webkitattachmentpathAttr); > } > >-void HTMLAttachmentElement::updateAttributes(std::optional<uint64_t>&& newFileSize, std::optional<String>&& newContentType, std::optional<String>&& newFilename) >+void HTMLAttachmentElement::updateAttributes(std::optional<uint64_t>&& newFileSize, const String& newContentType, const String& newFilename) > { >- if (newFilename) >- setAttributeWithoutSynchronization(HTMLNames::titleAttr, *newFilename); >+ if (!newFilename.isNull()) >+ setAttributeWithoutSynchronization(HTMLNames::titleAttr, newFilename); > else > removeAttribute(HTMLNames::titleAttr); > >- if (newContentType) >- setAttributeWithoutSynchronization(HTMLNames::typeAttr, *newContentType); >+ if (!newContentType.isNull()) >+ setAttributeWithoutSynchronization(HTMLNames::typeAttr, newContentType); > else > removeAttribute(HTMLNames::typeAttr); > >diff --git a/Source/WebCore/html/HTMLAttachmentElement.h b/Source/WebCore/html/HTMLAttachmentElement.h >index bf9443c6bfe8881302bf4ad0d9c64a3ed913da89..2f242214bf950f70b54df23b5feb76f362c6d14f 100644 >--- a/Source/WebCore/html/HTMLAttachmentElement.h >+++ b/Source/WebCore/html/HTMLAttachmentElement.h >@@ -48,7 +48,7 @@ public: > const String& uniqueIdentifier() const { return m_uniqueIdentifier; } > void setUniqueIdentifier(const String& uniqueIdentifier) { m_uniqueIdentifier = uniqueIdentifier; } > >- WEBCORE_EXPORT void updateAttributes(std::optional<uint64_t>&& newFileSize = std::nullopt, std::optional<String>&& newContentType = std::nullopt, std::optional<String>&& newFilename = std::nullopt); >+ WEBCORE_EXPORT void updateAttributes(std::optional<uint64_t>&& newFileSize, const String& newContentType, const String& newFilename); > > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; > void removedFromAncestor(RemovalType, ContainerNode&) final; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 7003120f658e9bbc0324d7ecdc25c853ad36dd10..5262d33c550ec85ab184518ad508db7c906204e3 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -7703,9 +7703,7 @@ void WebPageProxy::updateAttachmentAttributes(const API::Attachment& attachment, > } > > auto callbackID = m_callbacks.put(WTFMove(callback), m_process->throttler().backgroundActivityToken()); >- auto name = attachment.fileName(); >- auto optionalName = name.isNull() ? std::nullopt : std::optional<WTF::String> { name }; >- m_process->send(Messages::WebPage::UpdateAttachmentAttributes(attachment.identifier(), attachment.fileSizeForDisplay(), attachment.contentType(), WTFMove(optionalName), callbackID), m_pageID); >+ m_process->send(Messages::WebPage::UpdateAttachmentAttributes(attachment.identifier(), attachment.fileSizeForDisplay(), attachment.contentType(), attachment.fileName(), callbackID), m_pageID); > } > > void WebPageProxy::registerAttachmentIdentifierFromData(const String& identifier, const String& contentType, const String& preferredFileName, const IPC::DataReference& data) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 32659971940120454f5239cb00183a59cf5d90ab..76d27591cf12227f94e00d25f7869095b4909368 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -6073,11 +6073,11 @@ void WebPage::insertAttachment(const String& identifier, std::optional<uint64_t> > send(Messages::WebPageProxy::VoidCallback(callbackID)); > } > >-void WebPage::updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, std::optional<String>&& newFilename, CallbackID callbackID) >+void WebPage::updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, CallbackID callbackID) > { > if (auto attachment = attachmentElementWithIdentifier(identifier)) { > attachment->document().updateLayout(); >- attachment->updateAttributes(WTFMove(fileSize), contentType, WTFMove(newFilename)); >+ attachment->updateAttributes(WTFMove(fileSize), contentType, fileName); > } > send(Messages::WebPageProxy::VoidCallback(callbackID)); > } >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 2559a0d65565145c56eefb48bafb9f3d5e608a92..62fe50c6c7109300945f5e509f56bd2b80ca6698 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1073,7 +1073,7 @@ public: > > #if ENABLE(ATTACHMENT_ELEMENT) > void insertAttachment(const String& identifier, std::optional<uint64_t>&& fileSize, const String& fileName, const String& contentType, CallbackID); >- void updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, std::optional<String>&& newFilename, CallbackID); >+ void updateAttachmentAttributes(const String& identifier, std::optional<uint64_t>&& fileSize, const String& contentType, const String& fileName, CallbackID); > #endif > > #if ENABLE(APPLICATION_MANIFEST) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 7ddcb9b214bd9dd541947a94d2baf5a5e2537c9a..7e96a7ab49eea91cec1df307ced3652cdf6ab7c2 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -511,7 +511,7 @@ messages -> WebPage LegacyReceiver { > > #if ENABLE(ATTACHMENT_ELEMENT) > InsertAttachment(String identifier, std::optional<uint64_t> fileSize, String fileName, String contentType, WebKit::CallbackID callbackID) >- UpdateAttachmentAttributes(String identifier, std::optional<uint64_t> fileSize, String newContentType, std::optional<String> newFilename, WebKit::CallbackID callbackID) >+ UpdateAttachmentAttributes(String identifier, std::optional<uint64_t> fileSize, String contentType, String fileName, WebKit::CallbackID callbackID) > #endif > > #if ENABLE(APPLICATION_MANIFEST)
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 189080
: 348401