WebPageProxy attachment methods should return early if attachment element is not enabled
<https://webkit.org/b/209451>
<rdar://problem/60253260>
Reviewed by Chris Dumez.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::registerAttachmentIdentifierFromData):
(WebKit::WebPageProxy::registerAttachmentIdentifierFromFilePath):
(WebKit::WebPageProxy::registerAttachmentIdentifier):
(WebKit::WebPageProxy::registerAttachmentsFromSerializedData):
(WebKit::WebPageProxy::cloneAttachmentData):
(WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
(WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
- Add a message check for the attachment element being enabled.
(WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier): Ditto.
- Also add a missing message check to validate `identifier`.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259421 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 5399ee2..aae67e2 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2020-04-02 David Kilzer <ddkilzer@apple.com>
+
+ WebPageProxy attachment methods should return early if attachment element is not enabled
+ <https://webkit.org/b/209451>
+ <rdar://problem/60253260>
+
+ Reviewed by Chris Dumez.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::registerAttachmentIdentifierFromData):
+ (WebKit::WebPageProxy::registerAttachmentIdentifierFromFilePath):
+ (WebKit::WebPageProxy::registerAttachmentIdentifier):
+ (WebKit::WebPageProxy::registerAttachmentsFromSerializedData):
+ (WebKit::WebPageProxy::cloneAttachmentData):
+ (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
+ (WebKit::WebPageProxy::didInsertAttachmentWithIdentifier):
+ - Add a message check for the attachment element being enabled.
+ (WebKit::WebPageProxy::didRemoveAttachmentWithIdentifier): Ditto.
+ - Also add a missing message check to validate `identifier`.
+
2020-04-02 Chris Dumez <cdumez@apple.com>
[iOS] Replace UIKit background task with a RunningBoard FinishTaskInterruptable assertion
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
index 283ac48..02bc15d 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
@@ -9429,6 +9429,7 @@
void WebPageProxy::registerAttachmentIdentifierFromData(const String& identifier, const String& contentType, const String& preferredFileName, const IPC::SharedBufferDataReference& data)
{
+ MESSAGE_CHECK(m_process, m_preferences->attachmentElementEnabled());
MESSAGE_CHECK(m_process, IdentifierToAttachmentMap::isValidKey(identifier));
if (attachmentForIdentifier(identifier))
@@ -9443,6 +9444,7 @@
void WebPageProxy::registerAttachmentIdentifierFromFilePath(const String& identifier, const String& contentType, const String& filePath)
{
+ MESSAGE_CHECK(m_process, m_preferences->attachmentElementEnabled());
MESSAGE_CHECK(m_process, IdentifierToAttachmentMap::isValidKey(identifier));
if (attachmentForIdentifier(identifier))
@@ -9458,6 +9460,7 @@
void WebPageProxy::registerAttachmentIdentifier(const String& identifier)
{
+ MESSAGE_CHECK(m_process, m_preferences->attachmentElementEnabled());
MESSAGE_CHECK(m_process, IdentifierToAttachmentMap::isValidKey(identifier));
if (!attachmentForIdentifier(identifier))
@@ -9466,6 +9469,8 @@
void WebPageProxy::registerAttachmentsFromSerializedData(Vector<WebCore::SerializedAttachmentData>&& data)
{
+ MESSAGE_CHECK(m_process, m_preferences->attachmentElementEnabled());
+
for (auto& serializedData : data) {
auto identifier = WTFMove(serializedData.identifier);
if (!attachmentForIdentifier(identifier))
@@ -9475,6 +9480,7 @@
void WebPageProxy::cloneAttachmentData(const String& fromIdentifier, const String& toIdentifier)
{
+ MESSAGE_CHECK(m_process, m_preferences->attachmentElementEnabled());
MESSAGE_CHECK(m_process, IdentifierToAttachmentMap::isValidKey(fromIdentifier));
MESSAGE_CHECK(m_process, IdentifierToAttachmentMap::isValidKey(toIdentifier));
@@ -9504,6 +9510,9 @@
void WebPageProxy::serializedAttachmentDataForIdentifiers(const Vector<String>& identifiers, CompletionHandler<void(Vector<WebCore::SerializedAttachmentData>&&)>&& completionHandler)
{
Vector<WebCore::SerializedAttachmentData> serializedData;
+
+ MESSAGE_CHECK_COMPLETION(m_process, m_preferences->attachmentElementEnabled(), completionHandler(WTFMove(serializedData)));
+
for (const auto& identifier : identifiers) {
auto attachment = attachmentForIdentifier(identifier);
if (!attachment)
@@ -9550,6 +9559,7 @@
void WebPageProxy::didInsertAttachmentWithIdentifier(const String& identifier, const String& source, bool hasEnclosingImage)
{
+ MESSAGE_CHECK(m_process, m_preferences->attachmentElementEnabled());
MESSAGE_CHECK(m_process, IdentifierToAttachmentMap::isValidKey(identifier));
auto attachment = ensureAttachment(identifier);
@@ -9563,6 +9573,9 @@
void WebPageProxy::didRemoveAttachmentWithIdentifier(const String& identifier)
{
+ MESSAGE_CHECK(m_process, m_preferences->attachmentElementEnabled());
+ MESSAGE_CHECK(m_process, IdentifierToAttachmentMap::isValidKey(identifier));
+
if (auto attachment = attachmentForIdentifier(identifier))
didRemoveAttachment(*attachment);
}